1 -- Standard awesome library
3 -- Theme handling library
5 -- Notification library
8 -- Load Debian menu entries
11 -- {{{ Variable definitions
12 -- Themes define colours, icons, and wallpapers
13 -- The default is a dark theme
14 theme_path = "/usr/share/awesome/themes/default/theme"
15 -- Uncommment this for a lighter theme
16 -- theme_path = "/usr/share/awesome/themes/sky/theme"
18 -- Actually load theme
19 beautiful.init(theme_path)
21 -- This is used later as the default terminal and editor to run.
22 terminal = "x-terminal-emulator"
23 editor = os.getenv("EDITOR") or "editor"
24 editor_cmd = terminal .. " -e " .. editor
27 -- Usually, Mod4 is the key with a logo between Control and Alt.
28 -- If you do not like this or do not have such a key,
29 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
30 -- However, you can use another modifier like Mod1, but it may interact with others.
33 -- Table of layouts to cover with awful.layout.inc, order matters.
36 awful.layout.suit.tile,
37 awful.layout.suit.tile.left,
38 awful.layout.suit.tile.bottom,
39 awful.layout.suit.tile.top,
40 awful.layout.suit.fair,
41 awful.layout.suit.fair.horizontal,
42 awful.layout.suit.max,
43 awful.layout.suit.max.fullscreen,
44 awful.layout.suit.magnifier,
45 awful.layout.suit.floating
48 -- Table of clients that should be set floating. The index may be either
49 -- the application class or instance. The instance is useful when running
50 -- a console app in a terminal like (Music on Console)
51 -- x-terminal-emulator -name mocp -e mocp
62 -- Applications to be moved to a pre-defined tag by class or instance.
63 -- Use the screen and tags indices.
66 -- ["Firefox"] = { screen = 1, tag = 2 },
67 -- ["mocp"] = { screen = 2, tag = 4 },
70 -- Define if we want to use titlebar on all applications.
77 for s = 1, screen.count() do
78 -- Each screen has its own tag table.
80 -- Create 9 tags per screen.
81 for tagnumber = 1, 9 do
82 tags[s][tagnumber] = tag(tagnumber)
83 -- Add tags to screen one by one
84 tags[s][tagnumber].screen = s
85 awful.layout.set(layouts[1], tags[s][tagnumber])
87 -- I'm sure you want to see at least one tag.
88 tags[s][1].selected = true
93 -- Create a textbox widget
94 mytextbox = widget({ type = "textbox", align = "right" })
95 -- Set the default text in textbox
96 mytextbox.text = "<b><small> " .. AWESOME_RELEASE .. " </small></b>"
98 -- Create a laucher widget and a main menu
100 { "manual", terminal .. " -e man awesome" },
101 { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
102 { "restart", awesome.restart },
103 { "quit", awesome.quit }
106 mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
107 { "open terminal", terminal },
108 { "Debian", debian.menu.Debian_menu.Debian }
112 mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
116 mysystray = widget({ type = "systray", align = "right" })
118 -- Create a wibox for each screen and add it
123 mytaglist.buttons = { button({ }, 1, awful.tag.viewonly),
124 button({ modkey }, 1, awful.client.movetotag),
125 button({ }, 3, function (tag) tag.selected = not tag.selected end),
126 button({ modkey }, 3, awful.client.toggletag),
127 button({ }, 4, awful.tag.viewnext),
128 button({ }, 5, awful.tag.viewprev) }
130 mytasklist.buttons = { button({ }, 1, function (c)
131 if not c:isvisible() then
132 awful.tag.viewonly(c:tags()[1])
137 button({ }, 3, function () if instance then instance:hide() end instance = awful.menu.clients({ width=250 }) end),
138 button({ }, 4, function () awful.client.focus.byidx(1) end),
139 button({ }, 5, function () awful.client.focus.byidx(-1) end) }
141 for s = 1, screen.count() do
142 -- Create a promptbox for each screen
143 mypromptbox[s] = widget({ type = "textbox", align = "left" })
144 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
145 -- We need one layoutbox per screen.
146 mylayoutbox[s] = widget({ type = "imagebox", align = "right" })
147 mylayoutbox[s]:buttons({ button({ }, 1, function () awful.layout.inc(layouts, 1) end),
148 button({ }, 3, function () awful.layout.inc(layouts, -1) end),
149 button({ }, 4, function () awful.layout.inc(layouts, 1) end),
150 button({ }, 5, function () awful.layout.inc(layouts, -1) end) })
151 -- Create a taglist widget
152 mytaglist[s] = awful.widget.taglist.new(s, awful.widget.taglist.label.all, mytaglist.buttons)
154 -- Create a tasklist widget
155 mytasklist[s] = awful.widget.tasklist.new(function(c)
156 return awful.widget.tasklist.label.currenttags(c, s)
157 end, mytasklist.buttons)
160 mywibox[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal })
161 -- Add widgets to the wibox - order matters
162 mywibox[s].widgets = { mylauncher,
168 s == 1 and mysystray or nil }
169 mywibox[s].screen = s
173 -- {{{ Mouse bindings
175 button({ }, 3, function () mymainmenu:toggle() end),
176 button({ }, 4, awful.tag.viewnext),
177 button({ }, 5, awful.tag.viewprev)
184 -- key({ modkey, }, "Left", awful.tag.viewprev ),
185 -- key({ modkey, }, "Right", awful.tag.viewnext ),
186 key({ modkey, }, "Escape", awful.tag.history.restore),
188 key({ modkey, }, "j",
190 awful.client.focus.byidx( 1)
191 if client.focus then client.focus:raise() end
193 key({ modkey, }, "k",
195 awful.client.focus.byidx(-1)
196 if client.focus then client.focus:raise() end
199 -- Layout manipulation
200 key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
201 key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
202 key({ modkey, }, "Left", function () awful.screen.focus( 1) end),
203 key({ modkey, }, "Right", function () awful.screen.focus(-1) end),
204 key({ modkey, }, "u", awful.client.urgent.jumpto),
205 key({ modkey, }, "Tab",
207 awful.client.focus.history.previous()
214 key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
215 key({ modkey, "Control","Shift" }, "r", awesome.restart),
216 key({ modkey, "Control","Shift" }, "q", awesome.quit),
218 key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
219 key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
220 key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
221 key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
222 key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
223 key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
224 key({ modkey, }, "n", function () awful.layout.inc(layouts, 1) end),
225 key({ modkey, "Shift" }, "n", function () awful.layout.inc(layouts, -1) end),
228 key({ modkey }, "F1",
230 awful.prompt.run({ prompt = "Run: " },
231 mypromptbox[mouse.screen],
232 awful.util.spawn, awful.completion.bash,
233 awful.util.getdir("cache") .. "/history")
236 key({ modkey }, "F4",
238 awful.prompt.run({ prompt = "Run Lua code: " },
239 mypromptbox[mouse.screen],
240 awful.util.eval, awful.prompt.bash,
241 awful.util.getdir("cache") .. "/history_eval")
245 -- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
248 key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
249 key({ modkey, "Shift" }, "c", function (c) c:kill() end),
250 key({ modkey, }, "space", awful.client.floating.toggle ),
251 key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
252 key({ modkey, }, "o", awful.client.movetoscreen ),
253 key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
254 key({ modkey }, "t", awful.client.togglemarked),
257 c.maximized_horizontal = not c.maximized_horizontal
258 c.maximized_vertical = not c.maximized_vertical
262 -- Compute the maximum number of digit we need, limited to 9
264 for s = 1, screen.count() do
265 keynumber = math.min(9, math.max(#tags[s], keynumber));
268 for i = 1, keynumber do
269 table.insert(globalkeys,
272 local screen = mouse.screen
273 if tags[screen][i] then
274 awful.tag.viewonly(tags[screen][i])
277 table.insert(globalkeys,
278 key({ modkey, "Control" }, i,
280 local screen = mouse.screen
281 if tags[screen][i] then
282 tags[screen][i].selected = not tags[screen][i].selected
285 table.insert(globalkeys,
286 key({ modkey, "Shift" }, i,
288 if client.focus and tags[client.focus.screen][i] then
289 awful.client.movetotag(tags[client.focus.screen][i])
292 table.insert(globalkeys,
293 key({ modkey, "Control", "Shift" }, i,
295 if client.focus and tags[client.focus.screen][i] then
296 awful.client.toggletag(tags[client.focus.screen][i])
302 for i = 1, keynumber do
303 table.insert(globalkeys, key({ modkey, "Shift" }, "F" .. i,
305 local screen = mouse.screen
306 if tags[screen][i] then
307 for k, c in pairs(awful.client.getmarked()) do
308 awful.client.movetotag(tags[screen][i], c)
315 root.keys(globalkeys)
319 -- Hook function to execute when focusing a client.
320 awful.hooks.focus.register(function (c)
321 if not awful.client.ismarked(c) then
322 c.border_color = beautiful.border_focus
326 -- Hook function to execute when unfocusing a client.
327 awful.hooks.unfocus.register(function (c)
328 if not awful.client.ismarked(c) then
329 c.border_color = beautiful.border_normal
333 -- Hook function to execute when marking a client
334 awful.hooks.marked.register(function (c)
335 c.border_color = beautiful.border_marked
338 -- Hook function to execute when unmarking a client.
339 awful.hooks.unmarked.register(function (c)
340 c.border_color = beautiful.border_focus
343 -- Hook function to execute when the mouse enters a client.
344 awful.hooks.mouse_enter.register(function (c)
345 -- Sloppy focus, but disabled for magnifier layout
346 if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
347 and awful.client.focus.filter(c) then
352 -- Hook function to execute when a new client appears.
353 awful.hooks.manage.register(function (c, startup)
354 -- If we are not managing this application at startup,
355 -- move it to the screen where the mouse is.
356 -- We only do it for filtered windows (i.e. no dock, etc).
357 if not startup and awful.client.focus.filter(c) then
358 c.screen = mouse.screen
363 awful.titlebar.add(c, { modkey = modkey })
365 -- Add mouse bindings
367 button({ }, 1, function (c) client.focus = c; c:raise() end),
368 button({ modkey }, 1, awful.mouse.client.move),
369 button({ modkey }, 3, awful.mouse.client.resize)
371 -- New client may not receive focus
372 -- if they're not focusable, so set border anyway.
373 c.border_width = beautiful.border_width
374 c.border_color = beautiful.border_normal
376 -- Check if the application should be floating.
378 local inst = c.instance
379 if floatapps[cls] then
380 awful.client.floating.set(c, floatapps[cls])
381 elseif floatapps[inst] then
382 awful.client.floating.set(c, floatapps[inst])
385 -- Check application->screen/tag mappings.
388 target = apptags[cls]
389 elseif apptags[inst] then
390 target = apptags[inst]
393 c.screen = target.screen
394 awful.client.movetotag(tags[target.screen][target.tag], c)
397 -- Do this after tag mapping, so you don't see it on the wrong tag for a split second.
403 -- Set the windows at the slave,
404 -- i.e. put it at the end of others instead of setting it master.
405 -- awful.client.setslave(c)
407 -- Honor size hints: if you want to drop the gaps between windows, set this to false.
408 -- c.size_hints_honor = false
411 -- Hook function to execute when arranging the screen.
412 -- (tag switch, new client, etc)
413 awful.hooks.arrange.register(function (screen)
414 local layout = awful.layout.getname(awful.layout.get(screen))
415 if layout and beautiful["layout_" ..layout] then
416 mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
418 mylayoutbox[screen].image = nil
421 -- Give focus to the latest client in history if no window has focus
422 -- or if the current window is a desktop or a dock one.
423 if not client.focus then
424 local c = awful.client.focus.history.get(screen, 0)
425 if c then client.focus = c end
429 -- Hook called every second
430 awful.hooks.timer.register(1, function ()
431 -- For unix time_t lovers
432 mytextbox.text = " " .. os.time() .. " time_t "
434 -- mytextbox.text = " " .. os.date() .. " "