1 -- Standard awesome library
3 require("awful.autofocus")
5 -- Theme handling library
7 -- Notification library
10 -- {{{ Variable definitions
11 -- Themes define colours, icons, and wallpapers
12 beautiful
.init("@AWESOME_THEMES_PATH@/default/theme.lua")
14 -- This is used later as the default terminal and editor to run.
16 editor
= os
.getenv("EDITOR") or "nano"
17 editor_cmd
= terminal
.. " -e " .. editor
20 -- Usually, Mod4 is the key with a logo between Control and Alt.
21 -- If you do not like this or do not have such a key,
22 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
23 -- However, you can use another modifier like Mod1, but it may interact with others.
26 -- Table of layouts to cover with awful.layout.inc, order matters.
29 awful
.layout
.suit
.floating
,
30 awful
.layout
.suit
.tile
,
31 awful
.layout
.suit
.tile
.left
,
32 awful
.layout
.suit
.tile
.bottom
,
33 awful
.layout
.suit
.tile
.top
,
34 awful
.layout
.suit
.fair
,
35 awful
.layout
.suit
.fair
.horizontal
,
36 awful
.layout
.suit
.spiral
,
37 awful
.layout
.suit
.spiral
.dwindle
,
38 awful
.layout
.suit
.max,
39 awful
.layout
.suit
.max.fullscreen
,
40 awful
.layout
.suit
.magnifier
45 -- Define a tag table which hold all screen tags.
47 for s
= 1, screen
.count() do
48 -- Each screen has its own tag table.
49 tags
[s
] = awful
.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s
, layouts
[1])
54 -- Create a laucher widget and a main menu
56 { "manual", terminal
.. " -e man awesome" },
57 { "edit config", editor_cmd
.. " " .. awesome
.conffile
},
58 { "restart", awesome
.restart
},
59 { "quit", awesome
.quit
}
62 mymainmenu
= awful
.menu({ items
= { { "awesome", myawesomemenu
, beautiful
.awesome_icon
},
63 { "open terminal", terminal
}
67 mylauncher
= awful
.widget
.launcher({ image
= image(beautiful
.awesome_icon
),
72 -- Create a textclock widget
73 mytextclock
= awful
.widget
.textclock({ align
= "right" })
76 mysystray
= widget({ type = "systray" })
78 -- Create a wibox for each screen and add it
83 mytaglist
.buttons
= awful
.util
.table.join(
84 awful
.button({ }, 1, awful
.tag.viewonly
),
85 awful
.button({ modkey
}, 1, awful
.client
.movetotag
),
86 awful
.button({ }, 3, awful
.tag.viewtoggle
),
87 awful
.button({ modkey
}, 3, awful
.client
.toggletag
),
88 awful
.button({ }, 4, awful
.tag.viewnext
),
89 awful
.button({ }, 5, awful
.tag.viewprev
)
92 mytasklist
.buttons
= awful
.util
.table.join(
93 awful
.button({ }, 1, function (c
)
94 if c
== client
.focus
then
97 if not c
:isvisible() then
98 awful
.tag.viewonly(c
:tags()[1])
100 -- This will also un-minimize
101 -- the client, if needed
106 awful
.button({ }, 3, function ()
111 instance
= awful
.menu
.clients({ width
=250 })
114 awful
.button({ }, 4, function ()
115 awful
.client
.focus
.byidx(1)
116 if client
.focus
then client
.focus
:raise() end
118 awful
.button({ }, 5, function ()
119 awful
.client
.focus
.byidx(-1)
120 if client
.focus
then client
.focus
:raise() end
123 for s
= 1, screen
.count() do
124 -- Create a promptbox for each screen
125 mypromptbox
[s
] = awful
.widget
.prompt({ layout
= awful
.widget
.layout
.horizontal
.leftright
})
126 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
127 -- We need one layoutbox per screen.
128 mylayoutbox
[s
] = awful
.widget
.layoutbox(s
)
129 mylayoutbox
[s
]:buttons(awful
.util
.table.join(
130 awful
.button({ }, 1, function () awful
.layout
.inc(layouts
, 1) end),
131 awful
.button({ }, 3, function () awful
.layout
.inc(layouts
, -1) end),
132 awful
.button({ }, 4, function () awful
.layout
.inc(layouts
, 1) end),
133 awful
.button({ }, 5, function () awful
.layout
.inc(layouts
, -1) end)))
134 -- Create a taglist widget
135 mytaglist
[s
] = awful
.widget
.taglist(s
, awful
.widget
.taglist
.label
.all
, mytaglist
.buttons
)
137 -- Create a tasklist widget
138 mytasklist
[s
] = awful
.widget
.tasklist(function(c
)
139 return awful
.widget
.tasklist
.label
.currenttags(c
, s
)
140 end, mytasklist
.buttons
)
143 mywibox
[s
] = awful
.wibox({ position
= "top", screen
= s
})
144 -- Add widgets to the wibox - order matters
145 mywibox
[s
].widgets
= {
150 layout
= awful
.widget
.layout
.horizontal
.leftright
154 s
== 1 and mysystray
or nil,
156 layout
= awful
.widget
.layout
.horizontal
.rightleft
161 -- {{{ Mouse bindings
162 root
.buttons(awful
.util
.table.join(
163 awful
.button({ }, 3, function () mymainmenu
:toggle() end),
164 awful
.button({ }, 4, awful
.tag.viewnext
),
165 awful
.button({ }, 5, awful
.tag.viewprev
)
170 globalkeys
= awful
.util
.table.join(
171 awful
.key({ modkey
, }, "Left", awful
.tag.viewprev
),
172 awful
.key({ modkey
, }, "Right", awful
.tag.viewnext
),
173 awful
.key({ modkey
, }, "Escape", awful
.tag.history
.restore
),
175 awful
.key({ modkey
, }, "j",
177 awful
.client
.focus
.byidx( 1)
178 if client
.focus
then client
.focus
:raise() end
180 awful
.key({ modkey
, }, "k",
182 awful
.client
.focus
.byidx(-1)
183 if client
.focus
then client
.focus
:raise() end
185 awful
.key({ modkey
, }, "w", function () mymainmenu
:show({keygrabber
=true}) end),
187 -- Layout manipulation
188 awful
.key({ modkey
, "Shift" }, "j", function () awful
.client
.swap
.byidx( 1) end),
189 awful
.key({ modkey
, "Shift" }, "k", function () awful
.client
.swap
.byidx( -1) end),
190 awful
.key({ modkey
, "Control" }, "j", function () awful
.screen
.focus_relative( 1) end),
191 awful
.key({ modkey
, "Control" }, "k", function () awful
.screen
.focus_relative(-1) end),
192 awful
.key({ modkey
, }, "u", awful
.client
.urgent
.jumpto
),
193 awful
.key({ modkey
, }, "Tab",
195 awful
.client
.focus
.history
.previous()
202 awful
.key({ modkey
, }, "Return", function () awful
.util
.spawn(terminal
) end),
203 awful
.key({ modkey
, "Control" }, "r", awesome
.restart
),
204 awful
.key({ modkey
, "Shift" }, "q", awesome
.quit
),
206 awful
.key({ modkey
, }, "l", function () awful
.tag.incmwfact( 0.05) end),
207 awful
.key({ modkey
, }, "h", function () awful
.tag.incmwfact(-0.05) end),
208 awful
.key({ modkey
, "Shift" }, "h", function () awful
.tag.incnmaster( 1) end),
209 awful
.key({ modkey
, "Shift" }, "l", function () awful
.tag.incnmaster(-1) end),
210 awful
.key({ modkey
, "Control" }, "h", function () awful
.tag.incncol( 1) end),
211 awful
.key({ modkey
, "Control" }, "l", function () awful
.tag.incncol(-1) end),
212 awful
.key({ modkey
, }, "space", function () awful
.layout
.inc(layouts
, 1) end),
213 awful
.key({ modkey
, "Shift" }, "space", function () awful
.layout
.inc(layouts
, -1) end),
215 awful
.key({ modkey
, "Control" }, "n", awful
.client
.restore
),
218 awful
.key({ modkey
}, "r", function () mypromptbox
[mouse
.screen
]:run() end),
220 awful
.key({ modkey
}, "x",
222 awful
.prompt
.run({ prompt
= "Run Lua code: " },
223 mypromptbox
[mouse
.screen
].widget
,
224 awful
.util
.eval
, nil,
225 awful
.util
.getdir("cache") .. "/history_eval")
229 clientkeys
= awful
.util
.table.join(
230 awful
.key({ modkey
, }, "f", function (c
) c
.fullscreen
= not c
.fullscreen
end),
231 awful
.key({ modkey
, "Shift" }, "c", function (c
) c
:kill() end),
232 awful
.key({ modkey
, "Control" }, "space", awful
.client
.floating
.toggle
),
233 awful
.key({ modkey
, "Control" }, "Return", function (c
) c
:swap(awful
.client
.getmaster()) end),
234 awful
.key({ modkey
, }, "o", awful
.client
.movetoscreen
),
235 awful
.key({ modkey
, "Shift" }, "r", function (c
) c
:redraw() end),
236 awful
.key({ modkey
, }, "t", function (c
) c
.ontop
= not c
.ontop
end),
237 awful
.key({ modkey
, }, "n",
239 -- The client currently has the input focus, so it cannot be
240 -- minimized, since minimized clients can't have the focus.
243 awful
.key({ modkey
, }, "m",
245 c
.maximized_horizontal
= not c
.maximized_horizontal
246 c
.maximized_vertical
= not c
.maximized_vertical
250 -- Compute the maximum number of digit we need, limited to 9
252 for s
= 1, screen
.count() do
253 keynumber
= math
.min(9, math
.max(#tags
[s
], keynumber
));
256 -- Bind all key numbers to tags.
257 -- Be careful: we use keycodes to make it works on any keyboard layout.
258 -- This should map on the top row of your keyboard, usually 1 to 9.
259 for i
= 1, keynumber
do
260 globalkeys
= awful
.util
.table.join(globalkeys
,
261 awful
.key({ modkey
}, "#" .. i
+ 9,
263 local screen
= mouse
.screen
264 if tags
[screen
][i
] then
265 awful
.tag.viewonly(tags
[screen
][i
])
268 awful
.key({ modkey
, "Control" }, "#" .. i
+ 9,
270 local screen
= mouse
.screen
271 if tags
[screen
][i
] then
272 awful
.tag.viewtoggle(tags
[screen
][i
])
275 awful
.key({ modkey
, "Shift" }, "#" .. i
+ 9,
277 if client
.focus
and tags
[client
.focus
.screen
][i
] then
278 awful
.client
.movetotag(tags
[client
.focus
.screen
][i
])
281 awful
.key({ modkey
, "Control", "Shift" }, "#" .. i
+ 9,
283 if client
.focus
and tags
[client
.focus
.screen
][i
] then
284 awful
.client
.toggletag(tags
[client
.focus
.screen
][i
])
289 clientbuttons
= awful
.util
.table.join(
290 awful
.button({ }, 1, function (c
) client
.focus
= c
; c
:raise() end),
291 awful
.button({ modkey
}, 1, awful
.mouse
.client
.move
),
292 awful
.button({ modkey
}, 3, awful
.mouse
.client
.resize
))
295 root
.keys(globalkeys
)
299 awful
.rules
.rules
= {
300 -- All clients will match this rule.
302 properties
= { border_width
= beautiful
.border_width
,
303 border_color
= beautiful
.border_normal
,
306 buttons
= clientbuttons
} },
307 { rule
= { class
= "MPlayer" },
308 properties
= { floating
= true } },
309 { rule
= { class
= "pinentry" },
310 properties
= { floating
= true } },
311 { rule
= { class
= "gimp" },
312 properties
= { floating
= true } },
313 -- Set Firefox to always map on tags number 2 of screen 1.
314 -- { rule = { class = "Firefox" },
315 -- properties = { tag = tags[1][2] } },
320 -- Signal function to execute when a new client appears.
321 client
.add_signal("manage", function (c
, startup
)
323 -- awful.titlebar.add(c, { modkey = modkey })
325 -- Enable sloppy focus
326 c
:add_signal("mouse::enter", function(c
)
327 if awful
.layout
.get(c
.screen
) ~= awful
.layout
.suit
.magnifier
328 and awful
.client
.focus
.filter(c
) then
334 -- Set the windows at the slave,
335 -- i.e. put it at the end of others instead of setting it master.
336 -- awful.client.setslave(c)
338 -- Put windows in a smart way, only if they does not set an initial position.
339 if not c
.size_hints
.user_position
and not c
.size_hints
.program_position
then
340 awful
.placement
.no_overlap(c
)
341 awful
.placement
.no_offscreen(c
)
346 client
.add_signal("focus", function(c
) c
.border_color
= beautiful
.border_focus
end)
347 client
.add_signal("unfocus", function(c
) c
.border_color
= beautiful
.border_normal
end)