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

acfc111c4706972a8f78fb2b1f8a335ffb64659d
[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 = { mytaglist[s],
180                            mytasklist[s],
181                            mypromptbox[s],
182                            mytimebox,
183                            mylayoutbox[s],
184                            s == 1 and mysystray or nil }
185     mywibox[s].screen = s
186 end
187 -- }}}
188
189 -- Create a textbox widget
190 mytimebox = widget({ type = "textbox", name = "mytimebox", align = "right" })
191 mybatterybox = widget({ type = "textbox", name = "mybatterybox", align = "right" })
192
193 --Battery widget
194 batterywidget = widget({ type = 'progressbar', name = 'batterywidget' })
195 batterywidget.width = 100
196 batterywidget.height = 0.8
197 batterywidget.gap = 1
198 batterywidget.border_padding = 1
199 batterywidget.border_width = 1
200 batterywidget.ticks_count = 10
201 batterywidget.ticks_gap = 1
202 batterywidget.vertical = false
203 batterywidget:bar_properties_set('bat', {
204   bg = 'black',
205   fg = 'blue4',
206   fg_off = 'red',
207   reverse = false,
208   min_value = 0,
209   max_value = 100
210 })
211 -- }}}
212
213
214 -- {{{ Mouse bindings
215 awesome.buttons({
216     button({ }, 3, function () awful.menu.new({ id="mymainmenu", items=mymainmenu }) end),
217     button({ }, 4, awful.tag.viewnext),
218     button({ }, 5, awful.tag.viewprev)
219 })
220 -- }}}
221
222 -- {{{ Key bindings
223
224 -- Bind keyboard digits
225 -- Compute the maximum number of digit we need, limited to 9
226 keynumber = 0
227 for s = 1, screen.count() do
228    keynumber = math.min(9, math.max(#tags[s], keynumber));
229 end
230
231 for i = 1, keynumber do
232     keybinding({ modkey }, i,
233                    function ()
234                        local screen = mouse.screen
235                        if tags[screen][i] then
236                            awful.tag.viewonly(tags[screen][i])
237                        end
238                    end):add()
239     keybinding({ modkey, "Control" }, i,
240                    function ()
241                        local screen = mouse.screen
242                        if tags[screen][i] then
243                            tags[screen][i].selected = not tags[screen][i].selected
244                        end
245                    end):add()
246     keybinding({ modkey, "Shift" }, i,
247                    function ()
248                        if client.focus then
249                            if tags[client.focus.screen][i] then
250                                awful.client.movetotag(tags[client.focus.screen][i])
251                            end
252                        end
253                    end):add()
254     keybinding({ modkey, "Control", "Shift" }, i,
255                    function ()
256                        if client.focus then
257                            if tags[client.focus.screen][i] then
258                                awful.client.toggletag(tags[client.focus.screen][i])
259                            end
260                        end
261                    end):add()
262 end
263
264 keybinding({ modkey }, "Left", awful.tag.viewprev):add()
265 keybinding({ modkey }, "Right", awful.tag.viewnext):add()
266 keybinding({ modkey }, "Escape", awful.tag.history.restore):add()
267
268 -- Standard program
269 keybinding({ modkey }, "Return", function () awful.util.spawn(terminal) end):add()
270
271 keybinding({ modkey, "Control" }, "r", function ()
272                                            mypromptbox[mouse.screen].text =
273                                                awful.util.escape(awful.util.restart())
274                                         end):add()
275 keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
276
277 -- Client manipulation
278 keybinding({ modkey }, "m", awful.client.maximize):add()
279 keybinding({ modkey }, "f", function () client.focus.fullscreen = not client.focus.fullscreen end):add()
280 keybinding({ modkey, "Shift" }, "c", function () client.focus:kill() end):add()
281 keybinding({ modkey }, "j", function () awful.client.focus.byidx(1); client.focus:raise() end):add()
282 keybinding({ modkey }, "k", function () awful.client.focus.byidx(-1);  client.focus:raise() end):add()
283 keybinding({ modkey, "Shift" }, "j", function () awful.client.swap(1) end):add()
284 keybinding({ modkey, "Shift" }, "k", function () awful.client.swap(-1) end):add()
285 keybinding({ modkey, "Control" }, "j", function () awful.screen.focus(1) end):add()
286 keybinding({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end):add()
287 keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
288 keybinding({ modkey, "Control" }, "Return", function () client.focus:swap(awful.client.master()) end):add()
289 keybinding({ modkey }, "o", awful.client.movetoscreen):add()
290 keybinding({ modkey }, "Tab", awful.client.focus.history.previous):add()
291 keybinding({ modkey }, "u", awful.client.urgent.jumpto):add()
292 keybinding({ modkey, "Shift" }, "r", function () client.focus:redraw() end):add()
293
294 -- Layout manipulation
295 keybinding({ modkey }, "l", function () awful.tag.incmwfact(0.05) end):add()
296 keybinding({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end):add()
297 keybinding({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(1) end):add()
298 keybinding({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end):add()
299 keybinding({ modkey, "Control" }, "h", function () awful.tag.incncol(1) end):add()
300 keybinding({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end):add()
301 keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
302 keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
303
304 -- Prompt
305 keybinding({ modkey }, "F1", function ()
306                                  awful.prompt.run({ prompt = "Run: " }, mypromptbox[mouse.screen], awful.util.spawn, awful.completion.bash,
307                                                   awful.util.getdir("cache") .. "/history")
308                              end):add()
309 keybinding({ modkey }, "F4", function ()
310                                  awful.prompt.run({ prompt = "Run Lua code: " }, mypromptbox[mouse.screen], awful.util.eval, awful.prompt.bash,
311                                                   awful.util.getdir("cache") .. "/history_eval")
312                              end):add()
313
314 keybinding({ modkey, "Ctrl" }, "i", function ()
315                                         local s = mouse.screen
316                                         if mypromptbox[s].text then
317                                             mypromptbox[s].text = nil
318                                         else
319                                             mypromptbox[s].text = nil
320                                             if client.focus.class then
321                                                 mypromptbox[s].text = "Class: " .. client.focus.class .. " "
322                                             end
323                                             if client.focus.instance then
324                                                 mypromptbox[s].text = mypromptbox[s].text .. "Instance: ".. client.focus.instance .. " "
325                                             end
326                                             if client.focus.role then
327                                                 mypromptbox[s].text = mypromptbox[s].text .. "Role: ".. client.focus.role
328                                             end
329                                         end
330                                     end):add()
331
332 --- Tabulous, tab manipulation
333 keybinding({ modkey, "Control" }, "y", function ()
334     local tabbedview = tabulous.tabindex_get()
335     local nextclient = awful.client.next(1)
336
337     if not tabbedview then
338         tabbedview = tabulous.tabindex_get(nextclient)
339
340         if not tabbedview then
341             tabbedview = tabulous.tab_create()
342             tabulous.tab(tabbedview, nextclient)
343         else
344             tabulous.tab(tabbedview, client.focus)
345         end
346     else
347         tabulous.tab(tabbedview, nextclient)
348     end
349 end):add()
350
351 keybinding({ modkey, "Shift" }, "y", tabulous.untab):add()
352
353 keybinding({ modkey }, "y", function ()
354    local tabbedview = tabulous.tabindex_get()
355
356    if tabbedview then
357        local n = tabulous.next(tabbedview)
358        tabulous.display(tabbedview, n)
359    end
360 end):add()
361
362 -- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
363 keybinding({ modkey }, "t", awful.client.togglemarked):add()
364 keybinding({ modkey, 'Shift' }, "t", function ()
365     local tabbedview = tabulous.tabindex_get()
366     local clients = awful.client.getmarked()
367
368     if not tabbedview then
369         tabbedview = tabulous.tab_create(clients[1])
370         table.remove(clients, 1)
371     end
372
373     for k,c in pairs(clients) do
374         tabulous.tab(tabbedview, c)
375     end
376
377 end):add()
378
379 for i = 1, keynumber do
380     keybinding({ modkey, "Shift" }, "F" .. i,
381                    function ()
382                        local screen = mouse.screen
383                        if tags[screen][i] then
384                            for k, c in pairs(awful.client.getmarked()) do
385                                awful.client.movetotag(tags[screen][i], c)
386                            end
387                        end
388                    end):add()
389 end
390 -- }}}
391
392 -- {{{ Hooks
393 -- Hook function to execute when focusing a client.
394 awful.hooks.focus.register(function (c)
395     if not awful.client.ismarked(c) then
396         c.border_color = beautiful.border_focus
397     end
398 end)
399
400 -- Hook function to execute when unfocusing a client.
401 awful.hooks.unfocus.register(function (c)
402     if not awful.client.ismarked(c) then
403         c.border_color = beautiful.border_normal
404     end
405 end)
406
407 -- Hook function to execute when marking a client
408 awful.hooks.marked.register(function (c)
409     c.border_color = beautiful.border_marked
410 end)
411
412 -- Hook function to execute when unmarking a client.
413 awful.hooks.unmarked.register(function (c)
414     c.border_color = beautiful.border_focus
415 end)
416
417 -- Hook function to execute when the mouse enters a client.
418 awful.hooks.mouse_enter.register(function (c)
419     -- Sloppy focus, but disabled for magnifier layout
420     if awful.layout.get(c.screen) ~= "magnifier"
421         and awful.client.focus.filter(c) then
422         client.focus = c
423     end
424 end)
425
426 -- Hook function to execute when a new client appears.
427 awful.hooks.manage.register(function (c)
428     if use_titlebar then
429         -- Add a titlebar
430         awful.titlebar.add(c, { modkey = modkey })
431     end
432     -- Add mouse bindings
433     c:buttons({
434         button({ }, 1, function (c) client.focus = c; c:raise() end),
435         button({ modkey }, 1, function (c) c:mouse_move() end),
436         button({ modkey }, 3, function (c) c:mouse_resize() end)
437     })
438     -- New client may not receive focus
439     -- if they're not focusable, so set border anyway.
440     c.border_width = beautiful.border_width
441     c.border_color = beautiful.border_normal
442     client.focus = c
443
444     -- Check if the application should be floating.
445     -- OVERRIDDEN, SEE tiledapps BELOW
446     local cls = c.class
447     local inst = c.instance
448     if floatapps[cls] then
449         c.floating = floatapps[cls]
450     elseif floatapps[inst] then
451         c.floating = floatapps[inst]
452     end
453
454     -- Override with tiledapps
455     c.floating = not (tiledapps[inst] or tiledapps[cls])
456
457     -- Check application->screen/tag mappings.
458     local target
459     if apptags[cls] then
460         target = apptags[cls]
461     elseif apptags[inst] then
462         target = apptags[inst]
463     end
464     if target then
465         c.screen = target.screen
466         awful.client.movetotag(tags[target.screen][target.tag], c)
467     end
468
469     -- Set the windows at the slave,
470     -- i.e. put it at the end of others instead of setting it master.
471     -- awful.client.setslave(c)
472
473     -- Honor size hints: if you want to drop the gaps between windows, set this to false.
474     c.honorsizehints = true
475
476     -- Maximise some
477     if maxapps[inst] or maxapps[cls] then
478       awful.client.maximize(c)
479     end
480 end)
481
482 -- Hook function to execute when arranging the screen.
483 -- (tag switch, new client, etc)
484 awful.hooks.arrange.register(function (screen)
485     local layout = awful.layout.get(screen)
486     if layout then
487         mylayoutbox[screen].image = image("/home/madduck/code/awesome/share/awesome/icons/layouts/" .. layout .. "w.png")
488     else
489         mylayoutbox[screen].image = nil
490     end
491
492     -- Give focus to the latest client in history if no window has focus
493     -- or if the current window is a desktop or a dock one.
494     if not client.focus then
495         local c = awful.client.focus.history.get(screen, 0)
496         if c then client.focus = c end
497     end
498
499     -- Uncomment if you want mouse warping
500     --[[
501     if client.focus then
502         local c_c = client.focus:geometry()
503         local m_c = mouse.coords()
504
505         if m_c.x < c_c.x or m_c.x >= c_c.x + c_c.width or
506             m_c.y < c_c.y or m_c.y >= c_c.y + c_c.height then
507             if table.maxn(m_c.buttons) == 0 then
508                 mouse.coords({ x = c_c.x + 5, y = c_c.y + 5})
509             end
510         end
511     end
512     ]]
513 end)
514
515 -- Hook called every second
516 awful.hooks.timer.register(1, function ()
517     -- For unix time_t lovers
518     -- mytextbox.text = " " .. os.time() .. " time_t "
519     -- Otherwise use:
520     mytimebox.text = " " .. os.date() .. " "
521 end)
522
523 -- Hook called every sixty seconds
524 function hook_battery()
525     mybatterybox.text = " " .. get_acpibatt() .. " "
526 end
527
528 -- {{{ Statusbar battery
529 --
530 function get_acpibatt()
531
532     local f = io.popen('acpi -b', 'r')
533     if not f then
534       return "acpi -b failed"
535     end
536
537     local s = f:read('*l')
538     f:close()
539     if not s then
540       return '-';
541     end
542
543     -- Battery 0: Discharging, 89%, 00:02:14 remaining
544     -- Battery 0: Charging, 58%, 00:02:14 until charged
545     -- Battery 0: Full, 100%
546     -- so find the first bit first and then go look for the time
547     local st, en, status, percent = string.find(s, '%a+%s%d:%s(%a+),%s(%d+%%)');
548     local st, en, time = string.find(s, ',%s(%d+:%d+:%d+)%s%a+', en);
549
550     if not status or not percent then -- time can be empty if we're full
551       return "couldn't parse line " .. s
552     end
553
554     if not time then
555       return percent
556     end
557
558     if status == 'Charging' then
559       status = 'c';
560     elseif status == 'Discarching' then
561       status = 'd';
562     else
563       status = '-';
564     end
565
566     return percent; -- .. ' (' .. status .. ')'; -- .. ' ' .. time .. ' left';
567 end
568 -- }}}
569
570 --{{{ batt hook
571 local function get_bat()
572   local a = io.open("/sys/class/power_supply/BAT1/charge_full")
573   for line in a:lines() do
574     full = line
575   end
576   a:close()
577   local b = io.open("/sys/class/power_supply/BAT1/charge_now")
578   for line in b:lines() do
579     now = line
580   end
581   b:close()
582   batt=math.floor(now*100/full)
583   batterywidget:bar_data_add("bat",batt )
584 end
585 --}}}
586
587 -- Set up some hooks
588 awful.hooks.timer.register(120, hook_battery)
589 -- awful.hooks.timer.register(5, get_bat)
590 -- }}}
591
592 cmdmodkey = "Mod3"
593
594 -- xmms2 & sound
595 keybinding({ cmdmodkey }, "Prior", function () awful.util.spawn("amixer set Master 2+") end):add()
596 keybinding({ cmdmodkey }, "Next", function () awful.util.spawn("amixer set Master 2-") end):add()
597 keybinding({ cmdmodkey }, "Up", function () awful.util.spawn("amixer set PCM 2+") end):add()
598 keybinding({ cmdmodkey }, "Down", function () awful.util.spawn("amixer set PCM 2-") end):add()
599 keybinding({ cmdmodkey }, "Home", function () awful.util.spawn("amixer set Mic toggle") end):add()
600 keybinding({ cmdmodkey }, "End", function () awful.util.spawn("amixer set Master toggle") end):add()
601 keybinding({ cmdmodkey }, "Left", function () awful.util.spawn("xmms2 prev") end):add()
602 keybinding({ cmdmodkey }, "Right", function () awful.util.spawn("xmms2 next") end):add()
603 keybinding({ cmdmodkey }, "space", function () awful.util.spawn("xmms2 toggleplay") end):add()
604 keybinding({ cmdmodkey }, "backslash", function () awful.util.spawn("xmms2 current | head -1 | xmessage -nearmouse -timeout 5 -file -") end):add()
605 keybinding({ cmdmodkey, "Shift" }, "backslash", function () awful.util.spawn("xmms2 list | xmessage -nearmouse -timeout 5 -file -") end):add()
606
607 -- misc apps
608 keybinding({ cmdmodkey }, "n", function () awful.util.spawn("sensible-browser") end):add()
609 keybinding({ cmdmodkey }, "m", function () awful.util.spawn(terminal .. " -e mutt -f =store") end):add()
610 keybinding({ cmdmodkey }, "t", function () awful.util.spawn(terminal) end):add()
611 keybinding({ cmdmodkey }, "c", function () awful.util.spawn(terminal .. " -e python") end):add()
612 keybinding({ cmdmodkey }, "r", function () awful.util.spawn("gmrun") end):add()
613 keybinding({ cmdmodkey }, "j", function () awful.util.spawn("jpilot") end):add()
614 keybinding({ cmdmodkey }, "x", function () awful.util.spawn("/sbin/start-stop-daemon --start --background --exec /usr/bin/xscreensaver; xscreensaver-command -lock") end):add()
615 keybinding({ cmdmodkey, "Shift" }, "x", function () awful.util.spawn("xscreensaver-command -exit") end):add()
616
617 -- Highlight statusbars on the screen that has focus, 
618 -- set this to false if you only have one screen or 
619 -- you don't like it :P
620 if screen.count() > 1 then
621   statusbar_highlight_focus = true
622 else
623   statusbar_highlight_focus = false
624 end
625
626 hook_battery()