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.
1 -- Standard awesome library
3 require("awful.autofocus")
5 -- Theme handling library
7 -- Notification library
10 -- Load Debian menu entries
11 require("debian.menu")
13 -- {{{ Variable definitions
14 -- Themes define colours, icons, and wallpapers
15 -- The default is a dark theme
16 theme_path = "/usr/share/awesome/themes/default/theme.lua"
17 -- Uncommment this for a lighter theme
18 -- theme_path = "/usr/share/awesome/themes/sky/theme.lua"
20 -- Actually load theme
21 beautiful.init(theme_path)
23 -- This is used later as the default terminal and editor to run.
24 terminal = "x-terminal-emulator"
25 editor = os.getenv("EDITOR") or "editor"
26 editor_cmd = terminal .. " -e " .. editor
29 -- Usually, Mod4 is the key with a logo between Control and Alt.
30 -- If you do not like this or do not have such a key,
31 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
32 -- However, you can use another modifier like Mod1, but it may interact with others.
35 -- Table of layouts to cover with awful.layout.inc, order matters.
38 awful.layout.suit.tile,
39 awful.layout.suit.tile.left,
40 awful.layout.suit.tile.bottom,
41 awful.layout.suit.tile.top,
42 awful.layout.suit.fair,
43 awful.layout.suit.fair.horizontal,
44 awful.layout.suit.spiral,
45 awful.layout.suit.spiral.dwindle,
46 awful.layout.suit.max,
47 awful.layout.suit.max.fullscreen,
48 awful.layout.suit.magnifier,
49 awful.layout.suit.floating
52 -- Table of clients that should be set floating. The index may be either
53 -- the application class or instance. The instance is useful when running
54 -- a console app in a terminal like (Music on Console)
55 -- xterm -name mocp -e mocp
56 -- OVERRULED BY TILEDAPPS BELOW
65 ["Play stream"] = true,
69 -- Applications that should never float, assuming everything else floats
76 -- Applications that should be maximised
87 -- Applications to be moved to a pre-defined tag by class or instance.
88 -- Use the screen and tags indices.
91 ["Navigator"] = { screen = 1, tag = 9 },
93 ["-v"] = { screen = 1, tag = 8 },
96 -- Define if we want to use titlebar on all applications.
101 -- Define a tag table which hold all screen tags.
103 for s = 1, screen.count() do
104 -- Each screen has its own tag table.
105 tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s)
110 -- Create a laucher widget and a main menu
112 { "manual", terminal .. " -e man awesome" },
113 { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
114 { "restart", awesome.restart },
115 { "quit", awesome.quit }
118 mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
119 { "Debian", debian.menu.Debian_menu.Debian },
120 { "open terminal", terminal }
124 mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
129 -- Create a textclock widget
130 mytextclock = awful.widget.textclock({ align = "right" })
133 mysystray = widget({ type = "systray" })
135 -- Create a wibox for each screen and add it
140 mytaglist.buttons = awful.util.table.join(
141 awful.button({ }, 1, awful.tag.viewonly),
142 awful.button({ modkey }, 1, awful.client.movetotag),
143 awful.button({ }, 3, awful.tag.viewtoggle),
144 awful.button({ modkey }, 3, awful.client.toggletag),
145 awful.button({ }, 4, awful.tag.viewnext),
146 awful.button({ }, 5, awful.tag.viewprev)
149 mytasklist.buttons = awful.util.table.join(
150 awful.button({ }, 1, function (c)
151 if not c:isvisible() then
152 awful.tag.viewonly(c:tags()[1])
157 awful.button({ }, 3, function ()
162 instance = awful.menu.clients({ width=250 })
165 awful.button({ }, 4, function ()
166 awful.client.focus.byidx(1)
167 if client.focus then client.focus:raise() end
169 awful.button({ }, 5, function ()
170 awful.client.focus.byidx(-1)
171 if client.focus then client.focus:raise() end
174 for s = 1, screen.count() do
175 -- Create a promptbox for each screen
176 mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
177 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
178 -- We need one layoutbox per screen.
179 mylayoutbox[s] = awful.widget.layoutbox(s)
180 mylayoutbox[s]:buttons(awful.util.table.join(
181 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
182 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
183 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
184 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
185 -- Create a taglist widget
186 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
188 -- Create a tasklist widget
189 mytasklist[s] = awful.widget.tasklist(function(c)
190 return awful.widget.tasklist.label.currenttags(c, s)
191 end, mytasklist.buttons)
194 mywibox[s] = awful.wibox({ position = "top", screen = s })
195 -- Add widgets to the wibox - order matters
196 mywibox[s].widgets = {
201 layout = awful.widget.layout.horizontal.leftright
205 s == 1 and mysystray or nil,
207 layout = awful.widget.layout.horizontal.rightleft
213 batterywidget = widget({ type = 'progressbar', name = 'batterywidget' })
214 batterywidget.width = 100
215 batterywidget.height = 0.8
216 batterywidget.gap = 1
217 batterywidget.border_padding = 1
218 batterywidget.border_width = 1
219 batterywidget.ticks_count = 10
220 batterywidget.ticks_gap = 1
221 batterywidget.vertical = false
222 batterywidget:bar_properties_set('bat', {
233 -- {{{ Mouse bindings
234 root.buttons(awful.util.table.join(
235 awful.button({ }, 3, function () mymainmenu:toggle() end),
236 awful.button({ }, 4, awful.tag.viewnext),
237 awful.button({ }, 5, awful.tag.viewprev)
242 globalkeys = awful.util.table.join(
243 awful.key({ modkey, }, "Left", awful.tag.viewprev ),
244 awful.key({ modkey, }, "Right", awful.tag.viewnext ),
245 awful.key({ modkey, }, "Escape", awful.tag.history.restore),
246 awful.key({ modkey, "Shift" }, "Right", function () awful.screen.focus( 1) end),
247 awful.key({ modkey, "Shift" }, "Left", function () awful.screen.focus(-1) end),
248 awful.key({ modkey, "Shift" }, "h", awful.tag.viewprev ),
249 awful.key({ modkey, "Shift" }, "l", awful.tag.viewnext ),
251 awful.key({ modkey, }, "k",
253 awful.client.focus.byidx( 1)
254 if client.focus then client.focus:raise() end
256 awful.key({ modkey, }, "j",
258 awful.client.focus.byidx(-1)
259 if client.focus then client.focus:raise() end
261 awful.key({ modkey, }, "w", function () mymainmenu:show(true) end),
263 -- Layout manipulation
264 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( 1) end),
265 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( -1) end),
266 awful.key({ modkey, "Control" }, "k", function () awful.screen.focus( 1) end),
267 awful.key({ modkey, "Control" }, "j", function () awful.screen.focus(-1) end),
268 awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
269 awful.key({ modkey, }, "Tab",
271 awful.client.focus.history.previous()
278 awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
279 awful.key({ modkey, "Control" }, "r", awesome.restart),
280 awful.key({ modkey, "Shift" }, "q", awesome.quit),
282 awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
283 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
284 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
285 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
286 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
287 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
288 awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
289 awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
292 awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
294 awful.key({ modkey }, "x",
296 awful.prompt.run({ prompt = "Run Lua code: " },
297 mypromptbox[mouse.screen].widget,
298 awful.util.eval, nil,
299 awful.util.getdir("cache") .. "/history_eval")
303 clientkeys = awful.util.table.join(
304 awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
305 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
306 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
307 awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
308 awful.key({ modkey, }, "o", awful.client.movetoscreen ),
309 awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
310 awful.key({ modkey, }, "n", function (c) c.minimized = not c.minimized end),
311 awful.key({ modkey, }, "m",
313 c.maximized_horizontal = not c.maximized_horizontal
314 c.maximized_vertical = not c.maximized_vertical
318 -- Compute the maximum number of digit we need, limited to 9
320 for s = 1, screen.count() do
321 keynumber = math.min(9, math.max(#tags[s], keynumber));
324 -- Bind all key numbers to tags.
325 -- Be careful: we use keycodes to make it works on any keyboard layout.
326 -- This should map on the top row of your keyboard, usually 1 to 9.
327 for i = 1, keynumber do
328 globalkeys = awful.util.table.join(globalkeys,
329 awful.key({ modkey }, "#" .. i + 9,
331 local screen = mouse.screen
332 if tags[screen][i] then
333 awful.tag.viewonly(tags[screen][i])
336 awful.key({ modkey, "Control" }, "#" .. i + 9,
338 local screen = mouse.screen
339 if tags[screen][i] then
340 awful.tag.viewtoggle(tags[screen][i])
343 awful.key({ modkey, "Shift" }, "#" .. i + 9,
345 if client.focus and tags[client.focus.screen][i] then
346 awful.client.movetotag(tags[client.focus.screen][i])
349 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
351 if client.focus and tags[client.focus.screen][i] then
352 awful.client.toggletag(tags[client.focus.screen][i])
357 clientbuttons = awful.util.table.join(
358 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
359 awful.button({ modkey }, 1, awful.mouse.client.move),
360 awful.button({ modkey }, 3, awful.mouse.client.resize))
365 globalkeys = awful.util.table.join(globalkeys,
366 awful.key({ cmdmodkey }, "Prior", function () awful.util.spawn("amixer set Master 2+") end),
367 awful.key({ cmdmodkey }, "Next", function () awful.util.spawn("amixer set Master 2-") end),
368 awful.key({ cmdmodkey }, "Up", function () awful.util.spawn("amixer set PCM 2+") end),
369 awful.key({ cmdmodkey }, "Down", function () awful.util.spawn("amixer set PCM 2-") end),
370 awful.key({ cmdmodkey }, "Home", function () awful.util.spawn("amixer set Mic toggle") end),
371 awful.key({ cmdmodkey }, "End", function () awful.util.spawn("amixer set Master toggle") end),
372 awful.key({ cmdmodkey }, "Left", function () awful.util.spawn("xmms2 prev") end),
373 awful.key({ cmdmodkey }, "Right", function () awful.util.spawn("xmms2 next") end),
374 awful.key({ cmdmodkey }, "space", function () awful.util.spawn("xmms2 toggleplay") end),
375 awful.key({ cmdmodkey }, "backslash", function () awful.util.spawn_with_shell("xmms2 current | head -1 | xmessage -nearmouse -timeout 5 -file -") end),
376 awful.key({ cmdmodkey, "Shift" }, "backslash", function () awful.util.spawn_with_shell("xmms2 list | xmessage -nearmouse -timeout 5 -file -") end)
380 globalkeys = awful.util.table.join(globalkeys,
381 awful.key({ cmdmodkey }, "n", function () awful.util.spawn("sensible-browser") end),
382 awful.key({ cmdmodkey }, "m", function () awful.util.spawn(terminal .. " -e mutt -f =store") end),
383 awful.key({ cmdmodkey }, "t", function () awful.util.spawn(terminal) end),
384 awful.key({ cmdmodkey }, "c", function () awful.util.spawn(terminal .. " -e python") end),
385 -- awful.key({ cmdmodkey }, "r", function () awful.util.spawn("gmrun") end),
386 awful.key({ cmdmodkey }, "r", function () mypromptbox[mouse.screen]:run() end),
387 awful.key({ cmdmodkey }, "j", function () awful.util.spawn("jpilot") end),
388 awful.key({ cmdmodkey }, "x", function () awful.util.spawn_with_shell("/sbin/start-stop-daemon --start --background --exec /usr/bin/xscreensaver; xscreensaver-command -lock") end),
389 awful.key({ cmdmodkey, "Shift" }, "x", function () awful.util.spawn("xscreensaver-command -exit") end),
390 awful.key(nil, "XF86ScreenSaver", function () awful.util.spawn("xset dpms force off") end)
394 root.keys(globalkeys)
398 awful.rules.rules = {
399 -- All clients will match this rule.
401 properties = { border_width = beautiful.border_width,
402 border_color = beautiful.border_normal,
405 buttons = clientbuttons } },
406 { rule = { class = "MPlayer" },
407 properties = { floating = true } },
408 { rule = { class = "pinentry" },
409 properties = { floating = true } },
410 { rule = { class = "gimp" },
411 properties = { floating = true } },
412 -- Set Firefox to always map on tags number 2 of screen 1.
413 -- { rule = { class = "Firefox" },
414 -- properties = { tag = tags[1][2] } },
419 -- Signal function to execute when a new client appears.
420 client.add_signal("manage", function (c, startup)
422 -- awful.titlebar.add(c, { modkey = modkey })
424 -- Enable sloppy focus
425 c:add_signal("mouse::enter", function(c)
426 if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
427 and awful.client.focus.filter(c) then
433 -- Set the windows at the slave,
434 -- i.e. put it at the end of others instead of setting it master.
435 -- awful.client.setslave(c)
437 -- Put windows in a smart way, only if they does not set an initial position.
438 if not c.size_hints.user_position and not c.size_hints.program_position then
439 awful.placement.no_overlap(c)
440 awful.placement.no_offscreen(c)
445 client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
446 client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
450 local function get_bat()
451 local a = io.open("/sys/class/power_supply/BAT1/charge_full")
452 for line in a:lines() do
456 local b = io.open("/sys/class/power_supply/BAT1/charge_now")
457 for line in b:lines() do
461 batt=math.floor(now*100/full)
462 batterywidget:bar_data_add("bat",batt )
467 awful.hooks.timer.register(20, hook_battery)
468 -- awful.hooks.timer.register(5, get_bat)
471 -- Highlight statusbars on the screen that has focus,
472 -- set this to false if you only have one screen or
473 -- you don't like it :P
474 if screen.count() > 1 then
475 statusbar_highlight_focus = true
477 statusbar_highlight_focus = false