Commit 6368bf64318aec5ee65f4be978ae164a6023ab89

Authored by Ian Foster
1 parent 0a54620365
Exists in master

better tag names

Showing 1 changed file with 1 additions and 1 deletions Inline Diff

awesome/awesome/rc.lua View file @ 6368bf6
-------------------------------------- 1 1 --------------------------------------
---- Includes ---- 2 2 ---- Includes ----
-------------------------------------- 3 3 --------------------------------------
-- Standard awesome library 4 4 -- Standard awesome library
require("awful") 5 5 require("awful")
require("awful.autofocus") 6 6 require("awful.autofocus")
require("awful.rules") 7 7 require("awful.rules")
8 8
-- Theme handling library 9 9 -- Theme handling library
require("beautiful") 10 10 require("beautiful")
11 11
-- Notification library 12 12 -- Notification library
require("naughty") 13 13 require("naughty")
14 14
--Expose like plugin 15 15 --Expose like plugin
require("modules/revelation") 16 16 require("modules/revelation")
17 17
--calendaar popup 18 18 --calendaar popup
require('calendar2') 19 19 require('calendar2')
20 20
--freedesktop menus 21 21 --freedesktop menus
require('modules/awesome-freedesktop/freedesktop.utils') 22 22 require('modules/awesome-freedesktop/freedesktop.utils')
require('modules/awesome-freedesktop/freedesktop.menu') 23 23 require('modules/awesome-freedesktop/freedesktop.menu')
24 24
--for widgets 25 25 --for widgets
require("vicious") 26 26 require("vicious")
27 27
require("xrandr") 28 28 require("xrandr")
29 29
30 30
--local keydoc = require("keydoc") 31 31 --local keydoc = require("keydoc")
32 32
--make pretty things 33 33 --make pretty things
--this will crash if oocairo is not installed 34 34 --this will crash if oocairo is not installed
--bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=681279 35 35 --bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=681279
--require("blingbling") 36 36 --require("blingbling")
37 37
38 38
-------------------------------------- 39 39 --------------------------------------
---- Variables ---- 40 40 ---- Variables ----
-------------------------------------- 41 41 --------------------------------------
42 42
-- {{{ Variable definitions 43 43 -- {{{ Variable definitions
-- This is used later as the default terminal and editor to run. 44 44 -- This is used later as the default terminal and editor to run.
terminal = "terminator" 45 45 terminal = "terminator"
editor = os.getenv("EDITOR") or "vim" 46 46 editor = os.getenv("EDITOR") or "vim"
editor_cmd = terminal .. " -e " .. editor 47 47 editor_cmd = terminal .. " -e " .. editor
web_browser = "google-chrome" 48 48 web_browser = "google-chrome"
file_manager = "thunar" 49 49 file_manager = "thunar"
lock_command = "xscreensaver-command -lock" 50 50 lock_command = "xscreensaver-command -lock"
exit_command = "cb-exit" 51 51 exit_command = "cb-exit"
52 52
-- Default modkey. 53 53 -- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt. 54 54 -- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key, 55 55 -- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools. 56 56 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others. 57 57 -- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4" 58 58 modkey = "Mod4"
59 59
60 60
-------------------------------------- 61 61 --------------------------------------
---- Plugin Settings ---- 62 62 ---- Plugin Settings ----
-------------------------------------- 63 63 --------------------------------------
64 64
--set default naughty timeout 65 65 --set default naughty timeout
naughty.config.default_preset.timeout = 2 66 66 naughty.config.default_preset.timeout = 2
67 67
68 68
-- Themes define colours, icons, and wallpapers 69 69 -- Themes define colours, icons, and wallpapers
beautiful.init( awful.util.getdir("config") .. "/darkburn/theme.lua") 70 70 beautiful.init( awful.util.getdir("config") .. "/darkburn/theme.lua")
71 71
72 72
-------------------------------------- 73 73 --------------------------------------
---- Error Handleing ---- 74 74 ---- Error Handleing ----
-------------------------------------- 75 75 --------------------------------------
76 76
-- {{{ Error handling 77 77 -- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to 78 78 -- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config) 79 79 -- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then 80 80 if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical, 81 81 naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!", 82 82 title = "Oops, there were errors during startup!",
text = awesome.startup_errors }) 83 83 text = awesome.startup_errors })
end 84 84 end
85 85
-- Handle runtime errors after startup 86 86 -- Handle runtime errors after startup
do 87 87 do
local in_error = false 88 88 local in_error = false
awesome.add_signal("debug::error", function (err) 89 89 awesome.add_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop 90 90 -- Make sure we don't go into an endless error loop
if in_error then return end 91 91 if in_error then return end
in_error = true 92 92 in_error = true
93 93
naughty.notify({ preset = naughty.config.presets.critical, 94 94 naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!", 95 95 title = "Oops, an error happened!",
text = err }) 96 96 text = err })
in_error = false 97 97 in_error = false
end) 98 98 end)
end 99 99 end
-- }}} 100 100 -- }}}
101 101
102 102
-------------------------------------- 103 103 --------------------------------------
---- Tags and Layout ---- 104 104 ---- Tags and Layout ----
-------------------------------------- 105 105 --------------------------------------
106 106
-- Table of layouts to cover with awful.layout.inc, order matters. 107 107 -- Table of layouts to cover with awful.layout.inc, order matters.
layouts = 108 108 layouts =
{ 109 109 {
awful.layout.suit.tile, 110 110 awful.layout.suit.tile,
--awful.layout.suit.tile.left, 111 111 --awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom, 112 112 awful.layout.suit.tile.bottom,
--awful.layout.suit.tile.top, 113 113 --awful.layout.suit.tile.top,
--awful.layout.suit.fair, 114 114 --awful.layout.suit.fair,
--awful.layout.suit.fair.horizontal, 115 115 --awful.layout.suit.fair.horizontal,
--awful.layout.suit.spiral, 116 116 --awful.layout.suit.spiral,
--awful.layout.suit.spiral.dwindle, 117 117 --awful.layout.suit.spiral.dwindle,
awful.layout.suit.max, 118 118 awful.layout.suit.max,
--awful.layout.suit.max.fullscreen, 119 119 --awful.layout.suit.max.fullscreen,
--awful.layout.suit.magnifier, 120 120 --awful.layout.suit.magnifier,
awful.layout.suit.floating, 121 121 awful.layout.suit.floating,
} 122 122 }
-- }}} 123 123 -- }}}
124 124
-- {{{ Tags 125 125 -- {{{ Tags
-- Define a tag table which hold all screen tags. 126 126 -- Define a tag table which hold all screen tags.
tags = { 127 127 tags = {
names = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, 128 128 names = { '⠒', '⠓', '⠣', '⠧', '⠗', '⠝', '⠵', '⠹', '⠳' },
layout = { layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1],}, 129 129 layout = { layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1],},
} 130 130 }
for s = 1, screen.count() do 131 131 for s = 1, screen.count() do
-- Each screen has its own tag table. 132 132 -- Each screen has its own tag table.
tags[s] = awful.tag(tags.names, s, tags.layout) 133 133 tags[s] = awful.tag(tags.names, s, tags.layout)
end 134 134 end
-- }}} 135 135 -- }}}
136 136
137 137
-------------------------------------- 138 138 --------------------------------------
---- Menu ---- 139 139 ---- Menu ----
-------------------------------------- 140 140 --------------------------------------
141 141
-- {{{ Menu 142 142 -- {{{ Menu
-- Create a laucher widget and a main menu 143 143 -- Create a laucher widget and a main menu
myawesomemenu = { 144 144 myawesomemenu = {
{ "manual", terminal .. " -e man awesome" }, 145 145 { "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile }, 146 146 { "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart }, 147 147 { "restart", awesome.restart },
{ "quit", awesome.quit } 148 148 { "quit", awesome.quit }
} 149 149 }
150 150
menu_items = freedesktop.menu.new() 151 151 menu_items = freedesktop.menu.new()
table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon }) 152 152 table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon })
table.insert(menu_items, { "Exit", exit_command }) 153 153 table.insert(menu_items, { "Exit", exit_command })
154 154
mymainmenu = awful.menu.new({ items = menu_items, width = beautiful.menu_width }) 155 155 mymainmenu = awful.menu.new({ items = menu_items, width = beautiful.menu_width })
156 156
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), 157 157 mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu }) 158 158 menu = mymainmenu })
-- }}} 159 159 -- }}}
160 160
161 161
-------------------------------------- 162 162 --------------------------------------
---- WiBox ---- 163 163 ---- WiBox ----
-------------------------------------- 164 164 --------------------------------------
165 165
-- {{{ Wibox 166 166 -- {{{ Wibox
-- Create a textclock widget 167 167 -- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" }) 168 168 mytextclock = awful.widget.textclock({ align = "right" })
169 169
--calendar plugin 170 170 --calendar plugin
calendar2.addCalendarToWidget(mytextclock) 171 171 calendar2.addCalendarToWidget(mytextclock)
172 172
--separator widget 173 173 --separator widget
separator = widget({ type = "textbox" }) 174 174 separator = widget({ type = "textbox" })
separator.text = "|" 175 175 separator.text = "|"
176 176
--space widget 177 177 --space widget
space = widget({ type = "textbox" }) 178 178 space = widget({ type = "textbox" })
space.text = " " 179 179 space.text = " "
180 180
181 181
-- RAM usage widget 182 182 -- RAM usage widget
memwidget = awful.widget.progressbar() 183 183 memwidget = awful.widget.progressbar()
memwidget:set_width(8) 184 184 memwidget:set_width(8)
memwidget:set_height(beautiful.menu_height) 185 185 memwidget:set_height(beautiful.menu_height)
memwidget:set_vertical(true) 186 186 memwidget:set_vertical(true)
memwidget:set_background_color(beautiful.bg_widget) 187 187 memwidget:set_background_color(beautiful.bg_widget)
memwidget:set_color(beautiful.fg_widget) 188 188 memwidget:set_color(beautiful.fg_widget)
memwidget:set_gradient_colors({ beautiful.fg_widget, beautiful.fg_center_widget, beautiful.fg_end_widget }) 189 189 memwidget:set_gradient_colors({ beautiful.fg_widget, beautiful.fg_center_widget, beautiful.fg_end_widget })
-- RAM usage tooltip 190 190 -- RAM usage tooltip
memwidget_t = awful.tooltip({ objects = { memwidget.widget },}) 191 191 memwidget_t = awful.tooltip({ objects = { memwidget.widget },})
vicious.cache(vicious.widgets.mem) 192 192 vicious.cache(vicious.widgets.mem)
vicious.register(memwidget, vicious.widgets.mem, 193 193 vicious.register(memwidget, vicious.widgets.mem,
function (widget, args) 194 194 function (widget, args)
memwidget_t:set_text(" RAM: " .. args[1] .. "% " .. args[2] .. "MB / " .. args[3] .. "MB ") 195 195 memwidget_t:set_text(" RAM: " .. args[1] .. "% " .. args[2] .. "MB / " .. args[3] .. "MB ")
return args[1] 196 196 return args[1]
end, 5) 197 197 end, 5)
--update every 5 seconds 198 198 --update every 5 seconds
199 199
-- CPU usage widget 200 200 -- CPU usage widget
cpuwidget = awful.widget.graph() 201 201 cpuwidget = awful.widget.graph()
cpuwidget:set_width(30) 202 202 cpuwidget:set_width(30)
cpuwidget:set_height(beautiful.menu_height) 203 203 cpuwidget:set_height(beautiful.menu_height)
cpuwidget:set_background_color(beautiful.bg_widget) 204 204 cpuwidget:set_background_color(beautiful.bg_widget)
cpuwidget:set_color(beautiful.fg_widget) 205 205 cpuwidget:set_color(beautiful.fg_widget)
cpuwidget:set_gradient_angle(180) 206 206 cpuwidget:set_gradient_angle(180)
cpuwidget:set_gradient_colors({ beautiful.fg_widget, fg_center_widget, beautiful.fg_end_widget }) 207 207 cpuwidget:set_gradient_colors({ beautiful.fg_widget, fg_center_widget, beautiful.fg_end_widget })
cpuwidget_t = awful.tooltip({ objects = { cpuwidget.widget },}) 208 208 cpuwidget_t = awful.tooltip({ objects = { cpuwidget.widget },})
-- Register CPU widget 209 209 -- Register CPU widget
vicious.register(cpuwidget, vicious.widgets.cpu, 210 210 vicious.register(cpuwidget, vicious.widgets.cpu,
function (widget, args) 211 211 function (widget, args)
cpuwidget_t:set_text("CPU Usage: " .. args[1] .. "%") 212 212 cpuwidget_t:set_text("CPU Usage: " .. args[1] .. "%")
return args[1] 213 213 return args[1]
end, 2) 214 214 end, 2)
215 215
-- Create a systray 216 216 -- Create a systray
mysystray = widget({ type = "systray" }) 217 217 mysystray = widget({ type = "systray" })
218 218
-- Create a wibox for each screen and add it 219 219 -- Create a wibox for each screen and add it
mywibox = {} 220 220 mywibox = {}
mypromptbox = {} 221 221 mypromptbox = {}
mylayoutbox = {} 222 222 mylayoutbox = {}
mytaglist = {} 223 223 mytaglist = {}
mytaglist.buttons = awful.util.table.join( 224 224 mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly), 225 225 awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag), 226 226 awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle), 227 227 awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag), 228 228 awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext), 229 229 awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) 230 230 awful.button({ }, 5, awful.tag.viewprev)
) 231 231 )
mytasklist = {} 232 232 mytasklist = {}
mytasklist.buttons = awful.util.table.join( 233 233 mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c) 234 234 awful.button({ }, 1, function (c)
if c == client.focus then 235 235 if c == client.focus then
c.minimized = true 236 236 c.minimized = true
else 237 237 else
if not c:isvisible() then 238 238 if not c:isvisible() then
awful.tag.viewonly(c:tags()[1]) 239 239 awful.tag.viewonly(c:tags()[1])
end 240 240 end
-- This will also un-minimize 241 241 -- This will also un-minimize
-- the client, if needed 242 242 -- the client, if needed
client.focus = c 243 243 client.focus = c
c:raise() 244 244 c:raise()
end 245 245 end
end), 246 246 end),
awful.button({ }, 3, function () 247 247 awful.button({ }, 3, function ()
if instance then 248 248 if instance then
instance:hide() 249 249 instance:hide()
instance = nil 250 250 instance = nil
else 251 251 else
instance = awful.menu.clients({ width=250 }) 252 252 instance = awful.menu.clients({ width=250 })
end 253 253 end
end), 254 254 end),
awful.button({ }, 4, function () 255 255 awful.button({ }, 4, function ()
awful.client.focus.byidx(1) 256 256 awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end 257 257 if client.focus then client.focus:raise() end
end), 258 258 end),
awful.button({ }, 5, function () 259 259 awful.button({ }, 5, function ()
awful.client.focus.byidx(-1) 260 260 awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end 261 261 if client.focus then client.focus:raise() end
end)) 262 262 end))
263 263
for s = 1, screen.count() do 264 264 for s = 1, screen.count() do
-- Create a promptbox for each screen 265 265 -- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright }) 266 266 mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
-- Create an imagebox widget which will contains an icon indicating which layout we're using. 267 267 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen. 268 268 -- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s) 269 269 mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join( 270 270 mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), 271 271 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), 272 272 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), 273 273 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) 274 274 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget 275 275 -- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons) 276 276 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
277 277
-- Create a tasklist widget 278 278 -- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(function(c) 279 279 mytasklist[s] = awful.widget.tasklist(function(c)
return awful.widget.tasklist.label.currenttags(c, s) 280 280 return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons) 281 281 end, mytasklist.buttons)
282 282
-- Create the wibox 283 283 -- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s, height = beautiful.menu_height }) 284 284 mywibox[s] = awful.wibox({ position = "top", screen = s, height = beautiful.menu_height })
-- Add widgets to the wibox - order matters 285 285 -- Add widgets to the wibox - order matters
mywibox[s].widgets = { 286 286 mywibox[s].widgets = {
{ 287 287 {
mylauncher, 288 288 mylauncher,
mytaglist[s], 289 289 mytaglist[s],
mypromptbox[s], 290 290 mypromptbox[s],
layout = awful.widget.layout.horizontal.leftright 291 291 layout = awful.widget.layout.horizontal.leftright
}, 292 292 },
mylayoutbox[s], 293 293 mylayoutbox[s],
mytextclock, 294 294 mytextclock,
separator, 295 295 separator,
space, 296 296 space,
memwidget.widget, 297 297 memwidget.widget,
space, 298 298 space,
separator, 299 299 separator,
space, 300 300 space,
cpuwidget.widget, 301 301 cpuwidget.widget,
space, 302 302 space,
separator, 303 303 separator,
s == 1 and mysystray or nil, --only place the systray on the primary screen 304 304 s == 1 and mysystray or nil, --only place the systray on the primary screen
mytasklist[s], 305 305 mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft 306 306 layout = awful.widget.layout.horizontal.rightleft
} 307 307 }
end 308 308 end
-- }}} 309 309 -- }}}
310 310
311 311
-------------------------------------- 312 312 --------------------------------------
---- Key bindings ---- 313 313 ---- Key bindings ----
-------------------------------------- 314 314 --------------------------------------
315 315
-- {{{ Change workspace on scroll 316 316 -- {{{ Change workspace on scroll
root.buttons(awful.util.table.join( 317 317 root.buttons(awful.util.table.join(
--awful.button({ }, 3, function () mymainmenu:toggle() end), --I dont want a menu when I click on the desktop 318 318 --awful.button({ }, 3, function () mymainmenu:toggle() end), --I dont want a menu when I click on the desktop
awful.button({ }, 4, awful.tag.viewnext), 319 319 awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) 320 320 awful.button({ }, 5, awful.tag.viewprev)
)) 321 321 ))
-- }}} 322 322 -- }}}
323 323
324 324
-- {{{ Key bindings 325 325 -- {{{ Key bindings
globalkeys = awful.util.table.join( 326 326 globalkeys = awful.util.table.join(
327 327
--keydoc.group("Layout manipulation"), 328 328 --keydoc.group("Layout manipulation"),
329 329
330 330
--plugins 331 331 --plugins
awful.key({ modkey, }, "e", revelation), 332 332 awful.key({ modkey, }, "e", revelation),
--awful.key({ modkey, }, "F1", keydoc.display), --TODO finish this, needs arg string as last param 333 333 --awful.key({ modkey, }, "F1", keydoc.display), --TODO finish this, needs arg string as last param
334 334
--TODO make work 335 335 --TODO make work
awful.key({}, "XF86Display", xrandr), 336 336 awful.key({}, "XF86Display", xrandr),
337 337
--Conky toggle 338 338 --Conky toggle
awful.key({ }, "Pause", raise_conky, lower_conky), 339 339 awful.key({ }, "Pause", raise_conky, lower_conky),
--awful.key({}, "Pause", toggle_conky) 340 340 --awful.key({}, "Pause", toggle_conky)
341 341
--Move Client to Workspace Left/Right 342 342 --Move Client to Workspace Left/Right
--only works with 3.5, For 3.4 visit link 343 343 --only works with 3.5, For 3.4 visit link
--http://awesome.naquadah.org/wiki/Move_Window_to_Workspace_Left/Right 344 344 --http://awesome.naquadah.org/wiki/Move_Window_to_Workspace_Left/Right
awful.key({ modkey, "Shift" }, "Left", 345 345 awful.key({ modkey, "Shift" }, "Left",
function (c) 346 346 function (c)
local curidx = awful.tag.getidx() 347 347 local curidx = awful.tag.getidx()
if curidx == 1 then 348 348 if curidx == 1 then
awful.client.movetotag(tags[client.focus.screen][9]) 349 349 awful.client.movetotag(tags[client.focus.screen][9])
else 350 350 else
awful.client.movetotag(tags[client.focus.screen][curidx - 1]) 351 351 awful.client.movetotag(tags[client.focus.screen][curidx - 1])
end 352 352 end
--awful.tag.viewprev 353 353 --awful.tag.viewprev
end), 354 354 end),
awful.key({ modkey, "Shift" }, "Right", 355 355 awful.key({ modkey, "Shift" }, "Right",
function (c) 356 356 function (c)
local curidx = awful.tag.getidx() 357 357 local curidx = awful.tag.getidx()
if curidx == 9 then 358 358 if curidx == 9 then
awful.client.movetotag(tags[client.focus.screen][1]) 359 359 awful.client.movetotag(tags[client.focus.screen][1])
else 360 360 else
awful.client.movetotag(tags[client.focus.screen][curidx + 1]) 361 361 awful.client.movetotag(tags[client.focus.screen][curidx + 1])
end 362 362 end
--awful.tag.viewnext 363 363 --awful.tag.viewnext
end), 364 364 end),
awful.key({ modkey, }, "Left", awful.tag.viewprev ), 365 365 awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ), 366 366 awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore), 367 367 awful.key({ modkey, }, "Escape", awful.tag.history.restore),
368 368
awful.key({ modkey, }, "j", 369 369 awful.key({ modkey, }, "j",
function () 370 370 function ()
awful.client.focus.byidx( 1) 371 371 awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end 372 372 if client.focus then client.focus:raise() end
end), 373 373 end),
awful.key({ modkey, }, "k", 374 374 awful.key({ modkey, }, "k",
function () 375 375 function ()
awful.client.focus.byidx(-1) 376 376 awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end 377 377 if client.focus then client.focus:raise() end
end), 378 378 end),
--awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), --we dont like the menu 379 379 --awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), --we dont like the menu
380 380
-- Layout manipulation 381 381 -- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), 382 382 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), 383 383 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), 384 384 awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end), 385 385 awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto), 386 386 awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab", 387 387 awful.key({ modkey, }, "Tab",
function () 388 388 function ()
awful.client.focus.history.previous() 389 389 awful.client.focus.history.previous()
if client.focus then 390 390 if client.focus then
client.focus:raise() 391 391 client.focus:raise()
end 392 392 end
end), 393 393 end),
394 394
-- Standard program 395 395 -- Standard program
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), 396 396 awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
awful.key({ modkey, }, "w", function () awful.util.spawn(web_browser) end), --hotkey to start web-browser 397 397 awful.key({ modkey, }, "w", function () awful.util.spawn(web_browser) end), --hotkey to start web-browser
awful.key({ modkey, }, "f", function () awful.util.spawn(file_manager) end), --hotkey to start my file manager 398 398 awful.key({ modkey, }, "f", function () awful.util.spawn(file_manager) end), --hotkey to start my file manager
awful.key({ modkey, "Control" }, "l", function () awful.util.spawn(lock_command) end), --lock screen 399 399 awful.key({ modkey, "Control" }, "l", function () awful.util.spawn(lock_command) end), --lock screen
awful.key({ modkey, "Control" }, "r", awesome.restart), 400 400 awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit), 401 401 awful.key({ modkey, "Shift" }, "q", awesome.quit),
402 402
-- Standard program 403 403 -- Standard program
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), 404 404 awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), 405 405 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), 406 406 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), 407 407 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), 408 408 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), 409 409 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), 410 410 awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), 411 411 awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
412 412
awful.key({ modkey, "Control" }, "n", awful.client.restore), 413 413 awful.key({ modkey, "Control" }, "n", awful.client.restore),
414 414
-- Prompt 415 415 -- Prompt
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), 416 416 awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
417 417
awful.key({ modkey }, "x", 418 418 awful.key({ modkey }, "x",
function () 419 419 function ()
awful.prompt.run({ prompt = "Run Lua code: " }, 420 420 awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen].widget, 421 421 mypromptbox[mouse.screen].widget,
awful.util.eval, nil, 422 422 awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval") 423 423 awful.util.getdir("cache") .. "/history_eval")
end) 424 424 end)
) 425 425 )
426 426
427 427
-- Compute the maximum number of digit we need, limited to 9 428 428 -- Compute the maximum number of digit we need, limited to 9
keynumber = 0 429 429 keynumber = 0
for s = 1, screen.count() do 430 430 for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber)); 431 431 keynumber = math.min(9, math.max(#tags[s], keynumber));
end 432 432 end
433 433
-- Bind all key numbers to tags. 434 434 -- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout. 435 435 -- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9. 436 436 -- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, keynumber do 437 437 for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys, 438 438 globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, "#" .. i + 9, 439 439 awful.key({ modkey }, "#" .. i + 9,
function () 440 440 function ()
local screen = mouse.screen 441 441 local screen = mouse.screen
if tags[screen][i] then 442 442 if tags[screen][i] then
awful.tag.viewonly(tags[screen][i]) 443 443 awful.tag.viewonly(tags[screen][i])
end 444 444 end
end), 445 445 end),
awful.key({ modkey, "Control" }, "#" .. i + 9, 446 446 awful.key({ modkey, "Control" }, "#" .. i + 9,
function () 447 447 function ()
local screen = mouse.screen 448 448 local screen = mouse.screen
if tags[screen][i] then 449 449 if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i]) 450 450 awful.tag.viewtoggle(tags[screen][i])
end 451 451 end
end), 452 452 end),
awful.key({ modkey, "Shift" }, "#" .. i + 9, 453 453 awful.key({ modkey, "Shift" }, "#" .. i + 9,
function () 454 454 function ()
if client.focus and tags[client.focus.screen][i] then 455 455 if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i]) 456 456 awful.client.movetotag(tags[client.focus.screen][i])
end 457 457 end
end), 458 458 end),
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, 459 459 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function () 460 460 function ()
if client.focus and tags[client.focus.screen][i] then 461 461 if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i]) 462 462 awful.client.toggletag(tags[client.focus.screen][i])
end 463 463 end
end)) 464 464 end))
end 465 465 end
466 466
clientbuttons = awful.util.table.join( 467 467 clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end), 468 468 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move), 469 469 awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize)) 470 470 awful.button({ modkey }, 3, awful.mouse.client.resize))
471 471
-- Set keys 472 472 -- Set keys
root.keys(globalkeys) 473 473 root.keys(globalkeys)
-- }}} 474 474 -- }}}
475 475
476 476
-------------------------------------- 477 477 --------------------------------------
--- Rules ---- 478 478 --- Rules ----
-------------------------------------- 479 479 --------------------------------------
480 480
clientkeys = awful.util.table.join( 481 481 clientkeys = awful.util.table.join(
awful.key({ modkey, }, "F11", function (c) c.fullscreen = not c.fullscreen end), 482 482 awful.key({ modkey, }, "F11", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end), 483 483 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ), 484 484 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), 485 485 awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
--awful.key({ modkey, }, "o", awful.client.movetoscreen ), 486 486 --awful.key({ modkey, }, "o", awful.client.movetoscreen ),
--Move Client to Monitor Left/Right 487 487 --Move Client to Monitor Left/Right
awful.key({ modkey, }, "o", function(c) awful.client.movetoscreen(c,c.screen-1) end ), 488 488 awful.key({ modkey, }, "o", function(c) awful.client.movetoscreen(c,c.screen-1) end ),
awful.key({ modkey, }, "p", function(c) awful.client.movetoscreen(c,c.screen+1) end ), 489 489 awful.key({ modkey, }, "p", function(c) awful.client.movetoscreen(c,c.screen+1) end ),
490 490
--awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end), 491 491 --awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), 492 492 awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, }, "n", 493 493 awful.key({ modkey, }, "n",
function (c) 494 494 function (c)
-- The client currently has the input focus, so it cannot be 495 495 -- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus. 496 496 -- minimized, since minimized clients can't have the focus.
c.minimized = true 497 497 c.minimized = true
end), 498 498 end),
awful.key({ modkey, }, "m", 499 499 awful.key({ modkey, }, "m",
function (c) 500 500 function (c)
c.maximized_horizontal = not c.maximized_horizontal 501 501 c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical 502 502 c.maximized_vertical = not c.maximized_vertical
end) 503 503 end)
) 504 504 )
505 505
-- {{{ Rules 506 506 -- {{{ Rules
awful.rules.rules = { 507 507 awful.rules.rules = {
-- All clients will match this rule. 508 508 -- All clients will match this rule.
{ rule = { }, 509 509 { rule = { },
properties = { border_width = beautiful.border_width, 510 510 properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal, 511 511 border_color = beautiful.border_normal,
focus = true, 512 512 focus = true,
keys = clientkeys, 513 513 keys = clientkeys,
buttons = clientbuttons } }, 514 514 buttons = clientbuttons } },
{ rule = { class = "MPlayer" }, 515 515 { rule = { class = "MPlayer" },
properties = { floating = true } }, 516 516 properties = { floating = true } },
{ rule = { class = "pinentry" }, 517 517 { rule = { class = "pinentry" },
properties = { floating = true } }, 518 518 properties = { floating = true } },
{ rule = { class = "gimp" }, 519 519 { rule = { class = "gimp" },
properties = { floating = true } }, 520 520 properties = { floating = true } },
{ rule = { class = "Conky" }, 521 521 { rule = { class = "Conky" },
properties = { 522 522 properties = {
floating = true, 523 523 floating = true,
sticky = true, 524 524 sticky = true,
ontop = false, 525 525 ontop = false,
focusable = false, 526 526 focusable = false,
size_hints = {"program_position", "program_size"} 527 527 size_hints = {"program_position", "program_size"}
} 528 528 }
} 529 529 }
-- Set Firefox to always map on tags number 2 of screen 1. 530 530 -- Set Firefox to always map on tags number 2 of screen 1.
-- { rule = { class = "Firefox" }, 531 531 -- { rule = { class = "Firefox" },
-- properties = { tag = tags[1][2] } }, 532 532 -- properties = { tag = tags[1][2] } },
} 533 533 }
-- }}} 534 534 -- }}}
535 535
536 536