1 -- Standard awesome library
3 require("awful.autofocus")
5 -- Theme handling library
7 -- Notification library
10 require("obvious.volume_alsa")
12 -- Load Debian menu entries
13 require("debian.menu")
15 -- {{{ Variable definitions
16 -- Themes define colours, icons, and wallpapers
17 beautiful.init("/usr/share/awesome/themes/default/theme.lua")
19 -- This is used later as the default terminal and editor to run.
20 terminal = "x-terminal-emulator"
21 editor = os.getenv("EDITOR") or "editor"
22 editor_cmd = terminal .. " -e " .. editor
25 -- Usually, Mod4 is the key with a logo between Control and Alt.
26 -- If you do not like this or do not have such a key,
27 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
28 -- However, you can use another modifier like Mod1, but it may interact with others.
31 -- Table of layouts to cover with awful.layout.inc, order matters.
34 awful.layout.suit.tile,
35 awful.layout.suit.tile.left,
36 awful.layout.suit.tile.bottom,
37 awful.layout.suit.tile.top,
38 awful.layout.suit.fair,
39 awful.layout.suit.fair.horizontal,
40 awful.layout.suit.spiral,
41 awful.layout.suit.spiral.dwindle,
42 awful.layout.suit.max,
43 awful.layout.suit.max.fullscreen,
44 awful.layout.suit.magnifier,
45 awful.layout.suit.floating
50 -- Define a tag table which hold all screen tags.
52 for s = 1, screen.count() do
53 -- Each screen has its own tag table.
54 tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s)
59 -- Create a laucher widget and a main menu
61 { "manual", terminal .. " -e man awesome" },
62 { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
63 { "restart", awesome.restart },
64 { "quit", awesome.quit }
67 mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
68 { "Debian", debian.menu.Debian_menu.Debian },
69 { "open terminal", terminal }
73 mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
78 -- Create a textclock widget
79 mytextclock = awful.widget.textclock({ align = "right" }, " %c ", 1)
81 myvolumealsa = obvious.volume_alsa()
84 mysystray = widget({ type = "systray" })
86 -- Create a wibox for each screen and add it
91 mytaglist.buttons = awful.util.table.join(
92 awful.button({ }, 1, awful.tag.viewonly),
93 awful.button({ modkey }, 1, awful.client.movetotag),
94 awful.button({ }, 3, awful.tag.viewtoggle),
95 awful.button({ modkey }, 3, awful.client.toggletag),
96 awful.button({ }, 4, awful.tag.viewnext),
97 awful.button({ }, 5, awful.tag.viewprev)
100 mytasklist.buttons = awful.util.table.join(
101 awful.button({ }, 1, function (c)
102 if not c:isvisible() then
103 awful.tag.viewonly(c:tags()[1])
108 awful.button({ }, 3, function ()
113 instance = awful.menu.clients({ width=250 })
116 awful.button({ }, 4, function ()
117 awful.client.focus.byidx(1)
118 if client.focus then client.focus:raise() end
120 awful.button({ }, 5, function ()
121 awful.client.focus.byidx(-1)
122 if client.focus then client.focus:raise() end
125 for s = 1, screen.count() do
126 -- Create a promptbox for each screen
127 mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
128 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
129 -- We need one layoutbox per screen.
130 mylayoutbox[s] = awful.widget.layoutbox(s)
131 mylayoutbox[s]:buttons(awful.util.table.join(
132 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
133 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
134 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
135 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
136 -- Create a taglist widget
137 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
139 -- Create a tasklist widget
140 mytasklist[s] = awful.widget.tasklist(function(c)
141 return awful.widget.tasklist.label.currenttags(c, s)
142 end, mytasklist.buttons)
145 mywibox[s] = awful.wibox({ position = "top", screen = s })
146 -- Add widgets to the wibox - order matters
147 mywibox[s].widgets = {
152 layout = awful.widget.layout.horizontal.leftright
157 s == 1 and mysystray or nil,
159 layout = awful.widget.layout.horizontal.rightleft
164 -- {{{ Mouse bindings
165 root.buttons(awful.util.table.join(
166 awful.button({ }, 3, function () mymainmenu:toggle() end),
167 awful.button({ }, 4, awful.tag.viewnext),
168 awful.button({ }, 5, awful.tag.viewprev)
173 globalkeys = awful.util.table.join(
174 -- awful.key({ modkey, }, "Left", awful.tag.viewprev ),
175 -- awful.key({ modkey, }, "Right", awful.tag.viewnext ),
176 awful.key({},"XF86AudioRaiseVolume",function () obvious.volume_alsa.raise(0, "Master", 2) end),
177 awful.key({},"XF86AudioLowerVolume",function () obvious.volume_alsa.lower(0, "Master", 2) end),
178 awful.key({ modkey, }, "Escape", awful.tag.history.restore),
180 awful.key({ modkey, }, "j",
182 awful.client.focus.byidx( 1)
183 if client.focus then client.focus:raise() end
185 awful.key({ modkey, }, "k",
187 awful.client.focus.byidx(-1)
188 if client.focus then client.focus:raise() end
190 awful.key({ modkey, }, "w", function () mymainmenu:show(true) end),
192 -- Layout manipulation
193 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
194 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
195 awful.key({ modkey, }, "Left", function () awful.screen.focus_relative( 1) end),
196 awful.key({ modkey, }, "Right", function () awful.screen.focus_relative(-1) end),
197 awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
198 awful.key({ modkey, }, "Tab",
200 awful.client.focus.history.previous()
207 awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
208 awful.key({ modkey, "Control", "Shift" }, "r", awesome.restart),
209 awful.key({ modkey, "Control", "Shift" }, "q", awesome.quit),
211 awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
212 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
213 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
214 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
215 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
216 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
217 awful.key({ modkey, }, "n", function () awful.layout.inc(layouts, 1) end),
218 awful.key({ modkey, "Shift" }, "n", function () awful.layout.inc(layouts, -1) end),
221 awful.key({ modkey, "Shift" }, "Down", function () awful.client.moveresize(0, 20, 0, 0) end),
222 awful.key({ modkey, "Shift" }, "Up", function () awful.client.moveresize(0, -20, 0, 0) end),
223 awful.key({ modkey, "Shift" }, "Left", function () awful.client.moveresize(-20, 0, 0, 0) end),
224 awful.key({ modkey, "Shift" }, "Right", function () awful.client.moveresize(20, 0, 0, 0) end),
225 awful.key({ modkey, "Control" }, "Down", function () awful.client.moveresize(0, 0, 0, -20) end),
226 awful.key({ modkey, "Control" }, "Up", function () awful.client.moveresize(0, 0, 0, 20) end),
227 awful.key({ modkey, "Control" }, "Left", function () awful.client.moveresize(0, 0, -20, 0) end),
228 awful.key({ modkey, "Control" }, "Right", function () awful.client.moveresize(0, 0, 20, 0) end),
230 awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
232 awful.key({ modkey }, "x",
234 awful.prompt.run({ prompt = "Run Lua code: " },
235 mypromptbox[mouse.screen].widget,
236 awful.util.eval, nil,
237 awful.util.getdir("cache") .. "/history_eval")
241 clientkeys = awful.util.table.join(
242 awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
243 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
244 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
245 awful.key({ modkey, }, "space", function (c) c:swap(awful.client.getmaster()) end),
246 awful.key({ modkey, }, "o", awful.client.movetoscreen ),
247 awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
248 awful.key({ modkey, "Shift" }, "m", function (c) c.minimized = not c.minimized end),
249 awful.key({ modkey, }, "m",
251 c.maximized_horizontal = not c.maximized_horizontal
252 c.maximized_vertical = not c.maximized_vertical
256 -- Compute the maximum number of digit we need, limited to 9
258 for s = 1, screen.count() do
259 keynumber = math.min(9, math.max(#tags[s], keynumber));
262 -- Bind all key numbers to tags.
263 -- Be careful: we use keycodes to make it works on any keyboard layout.
264 -- This should map on the top row of your keyboard, usually 1 to 9.
265 for i = 1, keynumber do
266 globalkeys = awful.util.table.join(globalkeys,
267 awful.key({ modkey }, "#" .. i + 9,
269 local screen = mouse.screen
270 if tags[screen][i] then
271 awful.tag.viewonly(tags[screen][i])
274 awful.key({ modkey, "Control" }, "#" .. i + 9,
276 local screen = mouse.screen
277 if tags[screen][i] then
278 awful.tag.viewtoggle(tags[screen][i])
281 awful.key({ modkey, "Shift" }, "#" .. i + 9,
283 if client.focus and tags[client.focus.screen][i] then
284 awful.client.movetotag(tags[client.focus.screen][i])
287 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
289 if client.focus and tags[client.focus.screen][i] then
290 awful.client.toggletag(tags[client.focus.screen][i])
295 clientbuttons = awful.util.table.join(
296 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
297 awful.button({ modkey }, 1, awful.mouse.client.move),
298 awful.button({ modkey }, 3, awful.mouse.client.resize))
301 root.keys(globalkeys)
305 awful.rules.rules = {
306 -- All clients will match this rule.
308 properties = { border_width = beautiful.border_width,
309 border_color = beautiful.border_normal,
312 buttons = clientbuttons } },
313 { rule = { class = "MPlayer" },
314 properties = { floating = true } },
315 { rule = { class = "pinentry" },
316 properties = { floating = true } },
317 { rule = { class = "gimp" },
318 properties = { floating = true } },
319 -- Set Firefox to always map on tags number 2 of screen 1.
320 -- { rule = { class = "Firefox" },
321 -- properties = { tag = tags[1][2] } },
326 -- Signal function to execute when a new client appears.
327 client.add_signal("manage", function (c, startup)
329 -- awful.titlebar.add(c, { modkey = modkey })
331 -- Enable sloppy focus
332 c:add_signal("mouse::enter", function(c)
333 if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
334 and awful.client.focus.filter(c) then
340 -- Set the windows at the slave,
341 -- i.e. put it at the end of others instead of setting it master.
342 -- awful.client.setslave(c)
344 -- Put windows in a smart way, only if they does not set an initial position.
345 if not c.size_hints.user_position and not c.size_hints.program_position then
346 awful.placement.no_overlap(c)
347 awful.placement.no_offscreen(c)
352 client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
353 client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)