]> 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:

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