]> git.madduck.net Git - etc/awesome.git/blob - .config/awesome/rc.lua

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

1c4c651de7fa97c5e5ca45458e5dcd835723929d
[etc/awesome.git] / .config / awesome / rc.lua
1 -- awesome 3 configuration file
2
3 -- Include awesome library, with lots of useful function!
4 require("awful")
5 require("tabulous")
6 require("beautiful")
7
8 -- {{{ Variable definitions
9 -- This is a file path to a theme file which will defines colors.
10 theme_path = "/home/madduck/code/awesome/share/awesome/themes/default"
11
12 -- This is used later as the default terminal and editor to run.
13 terminal = "x-terminal-emulator"
14 editor = "sensible-editor"
15 editor_cmd = terminal .. " -e " .. editor
16
17 -- Default modkey.
18 -- Usually, Mod4 is the key with a logo between Control and Alt.
19 -- If you do not like this or do not have such a key,
20 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
21 -- However, you can use another modifier like Mod1, but it may interact with others.
22 modkey = "Mod4"
23
24 -- Table of layouts to cover with awful.layout.inc, order matters.
25 layouts =
26 {
27     "tile",
28     "tileleft",
29     "tilebottom",
30     "tiletop",
31     "fairh",
32     "fairv",
33     "magnifier",
34     "max",
35 --    "spiral",
36 --    "dwindle",
37     "floating"
38 }
39
40 -- Table of clients that should be set floating. The index may be either
41 -- the application class or instance. The instance is useful when running
42 -- a console app in a terminal like (Music on Console)
43 --    xterm -name mocp -e mocp
44 -- OVERRULED BY TILEDAPPS BELOW
45 floatapps =
46 {
47     -- by class
48     ["MPlayer"] = true,
49     ["pinentry"] = true,
50     ["GIMP"] = true,
51     ["twinkle"] = true,
52     ["Add-ons"] = true,
53     ["Play stream"] = true
54 }
55
56 -- Applications that should never float, assuming everything else floats
57 -- (by instance)
58 tiledapps =
59 {
60     ["urxvt"] = true
61 }
62
63 -- Applications that should be maximised
64 -- (by instance)
65 maxapps =
66 {
67     ["Navigator"] = true,
68     -- jpilot is -v
69     ["-v"] = true,
70     ["Xpdf"] = true,
71     ["gscan2pdf"] = true
72 }
73
74 -- Applications to be moved to a pre-defined tag by class or instance.
75 -- Use the screen and tags indices.
76 apptags =
77 {
78     ["Navigator"] = { screen = 1, tag = 9 },
79     -- jpilot is -v
80     ["-v"] = { screen = 1, tag = 8 },
81 }
82
83 -- Define if we want to use titlebar on all applications.
84 use_titlebar = false
85 -- }}}
86
87 -- {{{ Initialization
88 -- Initialize theme (colors).
89 beautiful.init(theme_path)
90
91 -- Register theme in awful.
92 -- This allows to not pass plenty of arguments to each function
93 -- to inform it about colors we want it to draw.
94 awful.beautiful.register(beautiful)
95
96 -- Uncomment this to activate autotabbing
97 -- tabulous.autotab_start()
98 -- }}}
99
100 -- {{{ Tags
101 -- Define tags table.
102 tags = {}
103 for s = 1, screen.count() do
104     -- Each screen has its own tag table.
105     tags[s] = {}
106     -- Create 9 tags per screen.
107     for tagnumber = 1, 9 do
108         tags[s][tagnumber] = tag({ name = tagnumber, layout = layouts[6] })
109         -- Add tags to screen one by one
110         -- split at 0.5/50% exactly
111         -- tags[s][tagnumber].mwfact = 0.5
112         tags[s][tagnumber].screen = s
113     end
114     -- I'm sure you want to see at least one tag.
115     tags[s][1].selected = true
116 end
117 -- }}}
118
119 -- {{{ Wibox
120 -- Create a textbox widget
121 mytextbox = widget({ type = "textbox", name = "mytextbox", align = "right" })
122 -- Set the default text in textbox
123 mytextbox.text = "<b><small> " .. AWESOME_RELEASE .. " </small></b>"
124
125 -- Create a laucher widget and a main menu
126 myawesomemenu = {
127    {"manual", terminal .. " -e man awesome" },
128    {"edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
129    {"restart", awesome.restart },
130    {"quit", awesome.quit }
131 }
132
133 mymainmenu = {
134    {"awesome", myawesomemenu, "/home/madduck/code/awesome/share/awesome/icons/awesome16.png" },
135    {"open terminal", terminal }
136 }
137
138 mylauncher = awful.widget.launcher({ name = "mylauncher",
139                                      image = "/home/madduck/code/awesome/share/awesome/icons/awesome16.png",
140                                      menu = { id="mymainmenu", items=mymainmenu } })
141
142 -- Create a systray
143 mysystray = widget({ type = "systray", name = "mysystray", align = "right" })
144
145 -- Create a wibox for each screen and add it
146 mywibox = {}
147 mypromptbox = {}
148 mylayoutbox = {}
149 mytaglist = {}
150 mytaglist.buttons = { button({ }, 1, awful.tag.viewonly),
151                       button({ modkey }, 1, awful.client.movetotag),
152                       button({ }, 3, function (tag) tag.selected = not tag.selected end),
153                       button({ modkey }, 3, awful.client.toggletag),
154                       button({ }, 4, awful.tag.viewnext),
155                       button({ }, 5, awful.tag.viewprev) }
156 mytasklist = {}
157 mytasklist.buttons = { button({ }, 1, function (c) client.focus = c; c:raise() end),
158                        button({ }, 3, function () awful.menu.clients({ width=250 }) end),
159                        button({ }, 4, function () awful.client.focus.byidx(1) end),
160                        button({ }, 5, function () awful.client.focus.byidx(-1) end) }
161
162 for s = 1, screen.count() do
163     mylayoutbox[s] = widget({ type = "imagebox", name = "mylayoutbox", align = "right" })
164     mylayoutbox[s]:buttons({ button({ }, 1, function () awful.layout.inc(layouts, 1) end),
165                              button({ }, 3, function () awful.layout.inc(layouts, -1) end),
166                              button({ }, 4, function () awful.layout.inc(layouts, 1) end),
167                              button({ }, 5, function () awful.layout.inc(layouts, -1) end) })
168     -- Create a taglist widget
169     mytaglist[s] = awful.widget.taglist.new(s, awful.widget.taglist.label.all, mytaglist.buttons)
170
171     -- Create a tasklist widget
172     mytasklist[s] = awful.widget.tasklist.new(function(c)
173                                                   return awful.widget.tasklist.label.currenttags(c, s)
174                                               end, mytasklist.buttons)
175
176     -- Create the wibox
177     mywibox[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal })
178     -- Add widgets to the wibox - order matters
179     mywibox[s].widgets = { mylauncher,
180                            mytaglist[s],
181                            mytasklist[s],
182                            mypromptbox[s],
183                            mytimebox,
184                            mylayoutbox[s],
185                            s == 1 and mysystray or nil }
186     mywibox[s].screen = s
187 end
188 -- }}}
189
190 -- Create a textbox widget
191 mytimebox = widget({ type = "textbox", name = "mytimebox", align = "right" })
192 mybatterybox = widget({ type = "textbox", name = "mybatterybox", align = "right" })
193
194 --Battery widget
195 batterywidget = widget({ type = 'progressbar', name = 'batterywidget' })
196 batterywidget.width = 100
197 batterywidget.height = 0.8
198 batterywidget.gap = 1
199 batterywidget.border_padding = 1
200 batterywidget.border_width = 1
201 batterywidget.ticks_count = 10
202 batterywidget.ticks_gap = 1
203 batterywidget.vertical = false
204 batterywidget:bar_properties_set('bat', {
205   bg = 'black',
206   fg = 'blue4',
207   fg_off = 'red',
208   reverse = false,
209   min_value = 0,
210   max_value = 100
211 })
212 -- }}}
213
214
215 -- {{{ Mouse bindings
216 awesome.buttons({
217     button({ }, 3, function () awful.menu.new({ id="mymainmenu", items=mymainmenu }) end),
218     button({ }, 4, awful.tag.viewnext),
219     button({ }, 5, awful.tag.viewprev)
220 })
221 -- }}}
222
223 -- {{{ Key bindings
224
225 -- Bind keyboard digits
226 -- Compute the maximum number of digit we need, limited to 9
227 keynumber = 0
228 for s = 1, screen.count() do
229    keynumber = math.min(9, math.max(#tags[s], keynumber));
230 end
231
232 for i = 1, keynumber do
233     keybinding({ modkey }, i,
234                    function ()
235                        local screen = mouse.screen
236                        if tags[screen][i] then
237                            awful.tag.viewonly(tags[screen][i])
238                        end
239                    end):add()
240     keybinding({ modkey, "Control" }, i,
241                    function ()
242                        local screen = mouse.screen
243                        if tags[screen][i] then
244                            tags[screen][i].selected = not tags[screen][i].selected
245                        end
246                    end):add()
247     keybinding({ modkey, "Shift" }, i,
248                    function ()
249                        if client.focus then
250                            if tags[client.focus.screen][i] then
251                                awful.client.movetotag(tags[client.focus.screen][i])
252                            end
253                        end
254                    end):add()
255     keybinding({ modkey, "Control", "Shift" }, i,
256                    function ()
257                        if client.focus then
258                            if tags[client.focus.screen][i] then
259                                awful.client.toggletag(tags[client.focus.screen][i])
260                            end
261                        end
262                    end):add()
263 end
264
265 keybinding({ modkey }, "Left", awful.tag.viewprev):add()
266 keybinding({ modkey }, "Right", awful.tag.viewnext):add()
267 keybinding({ modkey }, "Escape", awful.tag.history.restore):add()
268
269 -- Standard program
270 keybinding({ modkey }, "Return", function () awful.util.spawn(terminal) end):add()
271
272 keybinding({ modkey, "Control" }, "r", function ()
273                                            mypromptbox[mouse.screen].text =
274                                                awful.util.escape(awful.util.restart())
275                                         end):add()
276 keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
277
278 -- Client manipulation
279 keybinding({ modkey }, "m", awful.client.maximize):add()
280 keybinding({ modkey }, "f", function () client.focus.fullscreen = not client.focus.fullscreen end):add()
281 keybinding({ modkey, "Shift" }, "c", function () client.focus:kill() end):add()
282 keybinding({ modkey }, "j", function () awful.client.focus.byidx(1); client.focus:raise() end):add()
283 keybinding({ modkey }, "k", function () awful.client.focus.byidx(-1);  client.focus:raise() end):add()
284 keybinding({ modkey, "Shift" }, "j", function () awful.client.swap(1) end):add()
285 keybinding({ modkey, "Shift" }, "k", function () awful.client.swap(-1) end):add()
286 keybinding({ modkey, "Control" }, "j", function () awful.screen.focus(1) end):add()
287 keybinding({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end):add()
288 keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
289 keybinding({ modkey, "Control" }, "Return", function () client.focus:swap(awful.client.master()) end):add()
290 keybinding({ modkey }, "o", awful.client.movetoscreen):add()
291 keybinding({ modkey }, "Tab", awful.client.focus.history.previous):add()
292 keybinding({ modkey }, "u", awful.client.urgent.jumpto):add()
293 keybinding({ modkey, "Shift" }, "r", function () client.focus:redraw() end):add()
294
295 -- Layout manipulation
296 keybinding({ modkey }, "l", function () awful.tag.incmwfact(0.05) end):add()
297 keybinding({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end):add()
298 keybinding({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(1) end):add()
299 keybinding({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end):add()
300 keybinding({ modkey, "Control" }, "h", function () awful.tag.incncol(1) end):add()
301 keybinding({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end):add()
302 keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
303 keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
304
305 -- Prompt
306 keybinding({ modkey }, "F1", function ()
307                                  awful.prompt.run({ prompt = "Run: " }, mypromptbox[mouse.screen], awful.util.spawn, awful.completion.bash,
308                                                   awful.util.getdir("cache") .. "/history")
309                              end):add()
310 keybinding({ modkey }, "F4", function ()
311                                  awful.prompt.run({ prompt = "Run Lua code: " }, mypromptbox[mouse.screen], awful.util.eval, awful.prompt.bash,
312                                                   awful.util.getdir("cache") .. "/history_eval")
313                              end):add()
314
315 keybinding({ modkey, "Ctrl" }, "i", function ()
316                                         local s = mouse.screen
317                                         if mypromptbox[s].text then
318                                             mypromptbox[s].text = nil
319                                         else
320                                             mypromptbox[s].text = nil
321                                             if client.focus.class then
322                                                 mypromptbox[s].text = "Class: " .. client.focus.class .. " "
323                                             end
324                                             if client.focus.instance then
325                                                 mypromptbox[s].text = mypromptbox[s].text .. "Instance: ".. client.focus.instance .. " "
326                                             end
327                                             if client.focus.role then
328                                                 mypromptbox[s].text = mypromptbox[s].text .. "Role: ".. client.focus.role
329                                             end
330                                         end
331                                     end):add()
332
333 --- Tabulous, tab manipulation
334 keybinding({ modkey, "Control" }, "y", function ()
335     local tabbedview = tabulous.tabindex_get()
336     local nextclient = awful.client.next(1)
337
338     if not tabbedview then
339         tabbedview = tabulous.tabindex_get(nextclient)
340
341         if not tabbedview then
342             tabbedview = tabulous.tab_create()
343             tabulous.tab(tabbedview, nextclient)
344         else
345             tabulous.tab(tabbedview, client.focus)
346         end
347     else
348         tabulous.tab(tabbedview, nextclient)
349     end
350 end):add()
351
352 keybinding({ modkey, "Shift" }, "y", tabulous.untab):add()
353
354 keybinding({ modkey }, "y", function ()
355    local tabbedview = tabulous.tabindex_get()
356
357    if tabbedview then
358        local n = tabulous.next(tabbedview)
359        tabulous.display(tabbedview, n)
360    end
361 end):add()
362
363 -- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
364 keybinding({ modkey }, "t", awful.client.togglemarked):add()
365 keybinding({ modkey, 'Shift' }, "t", function ()
366     local tabbedview = tabulous.tabindex_get()
367     local clients = awful.client.getmarked()
368
369     if not tabbedview then
370         tabbedview = tabulous.tab_create(clients[1])
371         table.remove(clients, 1)
372     end
373
374     for k,c in pairs(clients) do
375         tabulous.tab(tabbedview, c)
376     end
377
378 end):add()
379
380 for i = 1, keynumber do
381     keybinding({ modkey, "Shift" }, "F" .. i,
382                    function ()
383                        local screen = mouse.screen
384                        if tags[screen][i] then
385                            for k, c in pairs(awful.client.getmarked()) do
386                                awful.client.movetotag(tags[screen][i], c)
387                            end
388                        end
389                    end):add()
390 end
391 -- }}}
392
393 -- {{{ Hooks
394 -- Hook function to execute when focusing a client.
395 awful.hooks.focus.register(function (c)
396     if not awful.client.ismarked(c) then
397         c.border_color = beautiful.border_focus
398     end
399 end)
400
401 -- Hook function to execute when unfocusing a client.
402 awful.hooks.unfocus.register(function (c)
403     if not awful.client.ismarked(c) then
404         c.border_color = beautiful.border_normal
405     end
406 end)
407
408 -- Hook function to execute when marking a client
409 awful.hooks.marked.register(function (c)
410     c.border_color = beautiful.border_marked
411 end)
412
413 -- Hook function to execute when unmarking a client.
414 awful.hooks.unmarked.register(function (c)
415     c.border_color = beautiful.border_focus
416 end)
417
418 -- Hook function to execute when the mouse enters a client.
419 awful.hooks.mouse_enter.register(function (c)
420     -- Sloppy focus, but disabled for magnifier layout
421     if awful.layout.get(c.screen) ~= "magnifier"
422         and awful.client.focus.filter(c) then
423         client.focus = c
424     end
425 end)
426
427 -- Hook function to execute when a new client appears.
428 awful.hooks.manage.register(function (c)
429     if use_titlebar then
430         -- Add a titlebar
431         awful.titlebar.add(c, { modkey = modkey })
432     end
433     -- Add mouse bindings
434     c:buttons({
435         button({ }, 1, function (c) client.focus = c; c:raise() end),
436         button({ modkey }, 1, function (c) c:mouse_move() end),
437         button({ modkey }, 3, function (c) c:mouse_resize() end)
438     })
439     -- New client may not receive focus
440     -- if they're not focusable, so set border anyway.
441     c.border_width = beautiful.border_width
442     c.border_color = beautiful.border_normal
443     client.focus = c
444
445     -- Check if the application should be floating.
446     -- OVERRIDDEN, SEE tiledapps BELOW
447     local cls = c.class
448     local inst = c.instance
449     if floatapps[cls] then
450         c.floating = floatapps[cls]
451     elseif floatapps[inst] then
452         c.floating = floatapps[inst]
453     end
454
455     -- Override with tiledapps
456     c.floating = not (tiledapps[inst] or tiledapps[cls])
457
458     -- Check application->screen/tag mappings.
459     local target
460     if apptags[cls] then
461         target = apptags[cls]
462     elseif apptags[inst] then
463         target = apptags[inst]
464     end
465     if target then
466         c.screen = target.screen
467         awful.client.movetotag(tags[target.screen][target.tag], c)
468     end
469
470     -- Set the windows at the slave,
471     -- i.e. put it at the end of others instead of setting it master.
472     -- awful.client.setslave(c)
473
474     -- Honor size hints: if you want to drop the gaps between windows, set this to false.
475     c.honorsizehints = true
476
477     -- Maximise some
478     if maxapps[inst] or maxapps[cls] then
479       awful.client.maximize(c)
480     end
481 end)
482
483 -- Hook function to execute when arranging the screen.
484 -- (tag switch, new client, etc)
485 awful.hooks.arrange.register(function (screen)
486     local layout = awful.layout.get(screen)
487     if layout then
488         mylayoutbox[screen].image = image("/home/madduck/code/awesome/share/awesome/icons/layouts/" .. layout .. "w.png")
489     else
490         mylayoutbox[screen].image = nil
491     end
492
493     -- Give focus to the latest client in history if no window has focus
494     -- or if the current window is a desktop or a dock one.
495     if not client.focus then
496         local c = awful.client.focus.history.get(screen, 0)
497         if c then client.focus = c end
498     end
499
500     -- Uncomment if you want mouse warping
501     --[[
502     if client.focus then
503         local c_c = client.focus:geometry()
504         local m_c = mouse.coords()
505
506         if m_c.x < c_c.x or m_c.x >= c_c.x + c_c.width or
507             m_c.y < c_c.y or m_c.y >= c_c.y + c_c.height then
508             if table.maxn(m_c.buttons) == 0 then
509                 mouse.coords({ x = c_c.x + 5, y = c_c.y + 5})
510             end
511         end
512     end
513     ]]
514 end)
515
516 -- Hook called every second
517 awful.hooks.timer.register(1, function ()
518     -- For unix time_t lovers
519     -- mytextbox.text = " " .. os.time() .. " time_t "
520     -- Otherwise use:
521     mytimebox.text = " " .. os.date() .. " "
522 end)
523
524 -- Hook called every sixty seconds
525 function hook_battery()
526     mybatterybox.text = " " .. get_acpibatt() .. " "
527 end
528
529 -- {{{ Statusbar battery
530 --
531 function get_acpibatt()
532
533     local f = io.popen('acpi -b', 'r')
534     if not f then
535       return "acpi -b failed"
536     end
537
538     local s = f:read('*l')
539     f:close()
540     if not s then
541       return '-';
542     end
543
544     -- Battery 0: Discharging, 89%, 00:02:14 remaining
545     -- Battery 0: Charging, 58%, 00:02:14 until charged
546     -- Battery 0: Full, 100%
547     -- so find the first bit first and then go look for the time
548     local st, en, status, percent = string.find(s, '%a+%s%d:%s(%a+),%s(%d+%%)');
549     local st, en, time = string.find(s, ',%s(%d+:%d+:%d+)%s%a+', en);
550
551     if not status or not percent then -- time can be empty if we're full
552       return "couldn't parse line " .. s
553     end
554
555     if not time then
556       return percent
557     end
558
559     if status == 'Charging' then
560       status = 'c';
561     elseif status == 'Discarching' then
562       status = 'd';
563     else
564       status = '-';
565     end
566
567     return percent; -- .. ' (' .. status .. ')'; -- .. ' ' .. time .. ' left';
568 end
569 -- }}}
570
571 --{{{ batt hook
572 local function get_bat()
573   local a = io.open("/sys/class/power_supply/BAT1/charge_full")
574   for line in a:lines() do
575     full = line
576   end
577   a:close()
578   local b = io.open("/sys/class/power_supply/BAT1/charge_now")
579   for line in b:lines() do
580     now = line
581   end
582   b:close()
583   batt=math.floor(now*100/full)
584   batterywidget:bar_data_add("bat",batt )
585 end
586 --}}}
587
588 -- Set up some hooks
589 awful.hooks.timer.register(120, hook_battery)
590 -- awful.hooks.timer.register(5, get_bat)
591 -- }}}
592
593 cmdmodkey = "Mod3"
594
595 -- xmms2 & sound
596 keybinding({ cmdmodkey }, "Prior", function () awful.util.spawn("amixer set Master 2+") end):add()
597 keybinding({ cmdmodkey }, "Next", function () awful.util.spawn("amixer set Master 2-") end):add()
598 keybinding({ cmdmodkey }, "Up", function () awful.util.spawn("amixer set PCM 2+") end):add()
599 keybinding({ cmdmodkey }, "Down", function () awful.util.spawn("amixer set PCM 2-") end):add()
600 keybinding({ cmdmodkey }, "Home", function () awful.util.spawn("amixer set Mic toggle") end):add()
601 keybinding({ cmdmodkey }, "End", function () awful.util.spawn("amixer set Master toggle") end):add()
602 keybinding({ cmdmodkey }, "Left", function () awful.util.spawn("xmms2 prev") end):add()
603 keybinding({ cmdmodkey }, "Right", function () awful.util.spawn("xmms2 next") end):add()
604 keybinding({ cmdmodkey }, "space", function () awful.util.spawn("xmms2 toggleplay") end):add()
605 keybinding({ cmdmodkey }, "backslash", function () awful.util.spawn("xmms2 current | head -1 | xmessage -nearmouse -timeout 5 -file -") end):add()
606 keybinding({ cmdmodkey, "Shift" }, "backslash", function () awful.util.spawn("xmms2 list | xmessage -nearmouse -timeout 5 -file -") end):add()
607
608 -- misc apps
609 keybinding({ cmdmodkey }, "n", function () awful.util.spawn("sensible-browser") end):add()
610 keybinding({ cmdmodkey }, "m", function () awful.util.spawn(terminal .. " -e mutt -f =store") end):add()
611 keybinding({ cmdmodkey }, "t", function () awful.util.spawn(terminal) end):add()
612 keybinding({ cmdmodkey }, "c", function () awful.util.spawn(terminal .. " -e python") end):add()
613 keybinding({ cmdmodkey }, "r", function () awful.util.spawn("gmrun") end):add()
614 keybinding({ cmdmodkey }, "j", function () awful.util.spawn("jpilot") end):add()
615 keybinding({ cmdmodkey }, "x", function () awful.util.spawn("/sbin/start-stop-daemon --start --background --exec /usr/bin/xscreensaver; xscreensaver-command -lock") end):add()
616 keybinding({ cmdmodkey, "Shift" }, "x", function () awful.util.spawn("xscreensaver-command -exit") end):add()
617
618 -- Highlight statusbars on the screen that has focus, 
619 -- set this to false if you only have one screen or 
620 -- you don't like it :P
621 if screen.count() > 1 then
622   statusbar_highlight_focus = true
623 else
624   statusbar_highlight_focus = false
625 end
626
627 hook_battery()