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.
2 -- Standard awesome library
3 local gears = require("gears")
4 local awful = require("awful")
5 require("awful.autofocus")
6 -- Widget and layout library
7 local wibox = require("wibox")
8 -- Theme handling library
9 local beautiful = require("beautiful")
10 -- Notification library
11 local naughty = require("naughty")
12 local menubar = require("menubar")
13 local hotkeys_popup = require("awful.hotkeys_popup").widget
17 -- Check if awesome encountered an error during startup and fell back to
18 -- another config (This code will only ever execute for the fallback config)
19 if awesome.startup_errors then
20 naughty.notify({ preset = naughty.config.presets.critical,
21 title = "Oops, there were errors during startup!",
22 text = awesome.startup_errors })
25 -- Handle runtime errors after startup
27 local in_error = false
28 awesome.connect_signal("debug::error", function (err)
29 -- Make sure we don't go into an endless error loop
30 if in_error then return end
33 naughty.notify({ preset = naughty.config.presets.critical,
34 title = "Oops, an error happened!",
35 text = tostring(err) })
41 -- {{{ Variable definitions
42 -- Themes define colours, icons, and wallpapers
43 beautiful.init(awful.util.get_themes_dir() .. "default/theme.lua")
45 -- This is used later as the default terminal and editor to run.
46 terminal = "x-terminal-emulator"
47 editor = "sensible-editor"
48 editor_cmd = terminal .. " -e " .. editor
51 -- Usually, Mod4 is the key with a logo between Control and Alt.
52 -- If you do not like this or do not have such a key,
53 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
54 -- However, you can use another modifier like Mod1, but it may interact with others.
58 -- Table of layouts to cover with awful.layout.inc, order matters.
59 awful.layout.layouts = {
60 awful.layout.suit.fair,
61 awful.layout.suit.tile,
62 -- awful.layout.suit.tile.left,
63 -- awful.layout.suit.tile.bottom,
64 awful.layout.suit.tile.top,
65 -- awful.layout.suit.spiral,
66 -- awful.layout.suit.spiral.dwindle,
67 awful.layout.suit.max,
68 awful.layout.suit.max.fullscreen,
69 -- awful.layout.suit.magnifier,
70 -- awful.layout.suit.corner.nw,
71 -- awful.layout.suit.corner.ne,
72 -- awful.layout.suit.corner.sw,
73 -- awful.layout.suit.corner.se,
74 awful.layout.suit.floating,
77 layout_default = awful.layout.layouts[1]
78 layout_tiled = awful.layout.layouts[2]
79 layout_maximised = awful.layout.layouts[4]
80 layout_floating = awful.layout.layouts[5]
83 -- {{{ Helper functions
84 local function client_menu_toggle_fn()
88 if instance and instance.wibox.visible then
92 instance = awful.menu.clients({ theme = { width = 250 } })
97 local function print_table(tbl, indent)
98 if not indent then indent = 0 end
99 for k, v in pairs(tbl) do
100 formatting = string.rep(" ", indent) .. k .. ": "
101 if type(v) == "table" then
103 print_table(v, indent+1)
105 print(formatting .. tostring(v))
112 -- Create a launcher widget and a main menu
114 { "hotkeys", function() return false, hotkeys_popup.show_help end},
115 { "manual", terminal .. " -e man awesome" },
116 { "edit config", editor_cmd .. " " .. awesome.conffile },
117 { "restart", awesome.restart },
118 { "quit", awesome.quit }
121 mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
122 { "open terminal", terminal }
126 mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
130 -- {{{ Menubar configuration
131 menubar.utils.terminal = terminal -- Set the terminal for applications that require it
135 -- Create a textclock widget
136 mytextclock = wibox.widget.textclock("%a %d %b %H:%M:%S", 1)
138 -- Keyboard map indicator and switcher
139 mykeyboardlayout = awful.widget.keyboardlayout()
141 -- Create a wibox for each screen and add it
146 mytaglist.buttons = awful.util.table.join(
147 awful.button({ }, 1, function(t) t:view_only() end),
148 awful.button({ modkey }, 1, function(t)
150 client.focus:move_to_tag(t)
153 awful.button({ }, 3, awful.tag.viewtoggle),
154 awful.button({ modkey }, 3, function(t)
156 client.focus:toggle_tag(t)
159 awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
160 awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
164 mytasklist.buttons = awful.util.table.join(
165 awful.button({ }, 1, function (c)
166 if c == client.focus then
169 -- Without this, the following
170 -- :isvisible() makes no sense
172 if not c:isvisible() and c.first_tag then
173 c.first_tag:view_only()
175 -- This will also un-minimize
176 -- the client, if needed
181 awful.button({ }, 3, client_menu_toggle_fn()),
182 awful.button({ }, 4, function ()
183 awful.client.focus.byidx(1)
185 awful.button({ }, 5, function ()
186 awful.client.focus.byidx(-1)
192 awful.screen.connect_for_each_screen(function(s)
194 --DISABLED--if beautiful.wallpaper then
195 --DISABLED-- local wallpaper = beautiful.wallpaper
196 --DISABLED-- -- If wallpaper is a function, call it with the screen
197 --DISABLED-- if type(wallpaper) == "function" then
198 --DISABLED-- wallpaper = wallpaper(s)
200 --DISABLED-- gears.wallpaper.maximized(wallpaper, s, true)
203 -- Each screen has its own tag table.
204 tags = awful.tag.new({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, layout_default)
205 tags[7].layout = layout_maximised
206 tags[8].layout = layout_maximised
207 tags[9].layout = layout_maximised
208 tags[1].selected = true
210 -- Create a promptbox for each screen
211 mypromptbox[s] = awful.widget.prompt()
212 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
213 -- We need one layoutbox per screen.
214 mylayoutbox[s] = awful.widget.layoutbox(s)
215 mylayoutbox[s]:buttons(awful.util.table.join(
216 awful.button({ }, 1, function () awful.layout.inc( 1) end),
217 awful.button({ }, 3, function () awful.layout.inc(-1) end),
218 awful.button({ }, 4, function () awful.layout.inc( 1) end),
219 awful.button({ }, 5, function () awful.layout.inc(-1) end)))
220 -- Create a taglist widget
221 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
223 -- Create a tasklist widget
224 mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
227 mywibox[s] = awful.wibar({ position = "top", screen = s })
229 -- Add widgets to the wibox
231 layout = wibox.layout.align.horizontal,
233 layout = wibox.layout.fixed.horizontal,
238 mytasklist[s], -- Middle widget
240 layout = wibox.layout.fixed.horizontal,
242 wibox.widget.systray(),
250 -- {{{ Mouse bindings
251 root.buttons(awful.util.table.join(
252 awful.button({ }, 3, function () mymainmenu:toggle() end),
253 awful.button({ }, 4, awful.tag.viewnext),
254 awful.button({ }, 5, awful.tag.viewprev)
259 globalkeys = awful.util.table.join(
260 awful.key({ modkey, }, "s", hotkeys_popup.show_help,
261 {description="show help", group="awesome"}),
262 awful.key({ modkey, }, "Left", awful.tag.viewprev,
263 {description = "view previous", group = "tag"}),
264 awful.key({ modkey, }, "Right", awful.tag.viewnext,
265 {description = "view next", group = "tag"}),
266 awful.key({ modkey, }, "Escape", awful.tag.history.restore,
267 {description = "go back", group = "tag"}),
269 awful.key({ modkey, }, "j",
271 awful.client.focus.byidx( 1)
273 {description = "focus next by index", group = "client"}
275 awful.key({ modkey, }, "k",
277 awful.client.focus.byidx(-1)
279 {description = "focus previous by index", group = "client"}
281 awful.key({ modkey, }, "w", function () mymainmenu:show() end,
282 {description = "show main menu", group = "awesome"}),
284 -- Layout manipulation
285 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
286 {description = "swap with next client by index", group = "client"}),
287 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
288 {description = "swap with previous client by index", group = "client"}),
289 awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
290 {description = "focus the next screen", group = "screen"}),
291 awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
292 {description = "focus the previous screen", group = "screen"}),
293 awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
294 {description = "jump to urgent client", group = "client"}),
295 awful.key({ modkey, }, "Tab",
297 awful.client.focus.history.previous()
302 {description = "go back", group = "client"}),
305 awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
306 {description = "open a terminal", group = "launcher"}),
307 awful.key({ modkey, "Control" }, "r", awesome.restart,
308 {description = "reload awesome", group = "awesome"}),
309 awful.key({ modkey, "Shift" }, "q", awesome.quit,
310 {description = "quit awesome", group = "awesome"}),
312 awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
313 {description = "increase master width factor", group = "layout"}),
314 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
315 {description = "decrease master width factor", group = "layout"}),
316 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
317 {description = "increase the number of master clients", group = "layout"}),
318 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
319 {description = "decrease the number of master clients", group = "layout"}),
320 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
321 {description = "increase the number of columns", group = "layout"}),
322 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
323 {description = "decrease the number of columns", group = "layout"}),
324 awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
325 {description = "select next", group = "layout"}),
326 awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
327 {description = "select previous", group = "layout"}),
329 awful.key({ modkey, "Control" }, "n",
331 local c = awful.client.restore()
332 -- Focus restored client
338 {description = "restore minimized", group = "client"}),
341 awful.key({ modkey }, "r", function () mypromptbox[awful.screen.focused()]:run() end,
342 {description = "run prompt", group = "launcher"}),
344 awful.key({ modkey }, "x",
346 awful.prompt.run({ prompt = "Run Lua code: " },
347 mypromptbox[awful.screen.focused()].widget,
348 awful.util.eval, nil,
349 awful.util.get_cache_dir() .. "/history_eval")
351 {description = "lua execute prompt", group = "awesome"}),
353 awful.key({ modkey }, "p", function() menubar.show() end,
354 {description = "show the menubar", group = "launcher"})
357 clientkeys = awful.util.table.join(
358 awful.key({ modkey, }, "f",
360 c.fullscreen = not c.fullscreen
363 {description = "toggle fullscreen", group = "client"}),
364 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
365 {description = "close", group = "client"}),
366 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
367 {description = "toggle floating", group = "client"}),
368 awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
369 {description = "move to master", group = "client"}),
370 awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
371 {description = "move to screen", group = "client"}),
372 awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
373 {description = "toggle keep on top", group = "client"}),
374 awful.key({ modkey, }, "n",
376 -- The client currently has the input focus, so it cannot be
377 -- minimized, since minimized clients can't have the focus.
380 {description = "minimize", group = "client"}),
381 awful.key({ modkey, }, "m",
383 c.maximized = not c.maximized
386 {description = "maximize", group = "client"})
389 -- Bind all key numbers to tags.
390 -- Be careful: we use keycodes to make it works on any keyboard layout.
391 -- This should map on the top row of your keyboard, usually 1 to 9.
393 globalkeys = awful.util.table.join(globalkeys,
395 awful.key({ modkey }, "#" .. i + 9,
397 local screen = awful.screen.focused()
398 local tag = screen.tags[i]
403 {description = "view tag #"..i, group = "tag"}),
405 awful.key({ modkey, "Control" }, "#" .. i + 9,
407 local screen = awful.screen.focused()
408 local tag = screen.tags[i]
410 awful.tag.viewtoggle(tag)
413 {description = "toggle tag #" .. i, group = "tag"}),
414 -- Move client to tag.
415 awful.key({ modkey, "Shift" }, "#" .. i + 9,
418 local tag = client.focus.screen.tags[i]
420 client.focus:move_to_tag(tag)
424 {description = "move focused client to tag #"..i, group = "tag"}),
425 -- Toggle tag on focused client.
426 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
429 local tag = client.focus.screen.tags[i]
431 client.focus:toggle_tag(tag)
435 {description = "toggle focused client on tag #" .. i, group = "tag"})
439 clientbuttons = awful.util.table.join(
440 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
441 awful.button({ modkey }, 1, awful.mouse.client.move),
442 awful.button({ modkey }, 3, awful.mouse.client.resize))
445 root.keys(globalkeys)
449 -- Rules to apply to new clients (through the "manage" signal).
450 awful.rules.rules = {
451 -- All clients will match this rule.
453 properties = { border_width = beautiful.border_width,
454 border_color = beautiful.border_normal,
455 focus = awful.client.focus.filter,
456 size_hints_honor = false,
459 buttons = clientbuttons,
460 placement = awful.placement.no_overlap+awful.placement.no_offscreen
467 "DTA", -- Firefox addon DownThemAll.
468 "copyq", -- Includes session name in class.
474 "MessageWin", -- kalarm.
482 "Event Tester", -- xev.
485 "AlarmWindow", -- Thunderbird's calendar.
486 "pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
488 }, properties = { floating = true }},
490 -- Add titlebars to normal clients and dialogs
491 { rule_any = {type = { "normal", "dialog" }
492 }, properties = { titlebars_enabled = false }
495 -- Set Firefox to always map on the tag named "2" on screen 1.
496 -- { rule = { class = "Firefox" },
497 -- properties = { screen = 1, tag = "2" } },
502 -- Signal function to execute when a new client appears.
503 client.connect_signal("manage", function (c)
504 -- Set the windows at the slave,
505 -- i.e. put it at the end of others instead of setting it master.
506 -- if not awesome.startup then awful.client.setslave(c) end
508 if awesome.startup and
509 not c.size_hints.user_position
510 and not c.size_hints.program_position then
511 -- Prevent clients from being unreachable after screen count changes.
512 awful.placement.no_offscreen(c)
516 -- Add a titlebar if titlebars_enabled is set to true in the rules.
517 client.connect_signal("request::titlebars", function(c)
518 -- buttons for the titlebar
519 local buttons = awful.util.table.join(
520 awful.button({ }, 1, function()
523 awful.mouse.client.move(c)
525 awful.button({ }, 3, function()
528 awful.mouse.client.resize(c)
532 awful.titlebar(c) : setup {
534 awful.titlebar.widget.iconwidget(c),
536 layout = wibox.layout.fixed.horizontal
541 widget = awful.titlebar.widget.titlewidget(c)
544 layout = wibox.layout.flex.horizontal
547 awful.titlebar.widget.floatingbutton (c),
548 awful.titlebar.widget.maximizedbutton(c),
549 awful.titlebar.widget.stickybutton (c),
550 awful.titlebar.widget.ontopbutton (c),
551 awful.titlebar.widget.closebutton (c),
552 layout = wibox.layout.fixed.horizontal()
554 layout = wibox.layout.align.horizontal
558 -- Enable sloppy focus
559 client.connect_signal("mouse::enter", function(c)
560 if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
561 and awful.client.focus.filter(c) then
566 client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
567 client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
570 -- vim:ft=lua:sw=4:sts=4:ts=4:et