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

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