1 -- Standard awesome library
3 require("awful.autofocus")
5 -- Theme handling library
7 -- Notification library
10 -- {{{ Variable definitions
11 -- This is used later as the default terminal and editor to run.
13 editor
= os
.getenv("EDITOR") or "nano"
14 editor_cmd
= terminal
.. " -e " .. editor
17 -- Usually, Mod4 is the key with a logo between Control and Alt.
18 -- If you do not like this or do not have such a key,
19 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
20 -- However, you can use another modifier like Mod1, but it may interact with others.
23 -- Table of layouts to cover with awful.layout.inc, order matters.
26 awful
.layout
.suit
.tile
,
27 awful
.layout
.suit
.tile
.left
,
28 awful
.layout
.suit
.tile
.bottom
,
29 awful
.layout
.suit
.tile
.top
,
30 awful
.layout
.suit
.fair
,
31 awful
.layout
.suit
.fair
.horizontal
,
32 awful
.layout
.suit
.spiral
,
33 awful
.layout
.suit
.spiral
.dwindle
,
34 awful
.layout
.suit
.max,
35 awful
.layout
.suit
.max.fullscreen
,
36 awful
.layout
.suit
.magnifier
,
37 awful
.layout
.suit
.floating
42 -- Define a tag table which hold all screen tags.
44 for s
= 1, screen
.count() do
45 -- Each screen has its own tag table.
46 tags
[s
] = awful
.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s
)
51 -- Create a textclock widget
52 mytextclock
= awful
.widget
.textclock({ align
= "right" })
54 -- Create a laucher widget and a main menu
56 { "manual", terminal
.. " -e man awesome" },
57 { "edit config", editor_cmd
.. " " .. awful
.util
.getdir("config") .. "/rc.lua" },
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
),
71 mysystray
= widget({ type = "systray" })
73 -- Create a wibox for each screen and add it
78 mytaglist
.buttons
= awful
.util
.table.join(
79 awful
.button({ }, 1, awful
.tag.viewonly
),
80 awful
.button({ modkey
}, 1, awful
.client
.movetotag
),
81 awful
.button({ }, 3, function (tag) tag.selected
= not tag.selected
end),
82 awful
.button({ modkey
}, 3, awful
.client
.toggletag
),
83 awful
.button({ }, 4, awful
.tag.viewnext
),
84 awful
.button({ }, 5, awful
.tag.viewprev
)
87 mytasklist
.buttons
= awful
.util
.table.join(
88 awful
.button({ }, 1, function (c
)
89 if not c
:isvisible() then
90 awful
.tag.viewonly(c
:tags()[1])
95 awful
.button({ }, 3, function ()
100 instance
= awful
.menu
.clients({ width
=250 })
103 awful
.button({ }, 4, function ()
104 awful
.client
.focus
.byidx(1)
105 if client
.focus
then client
.focus
:raise() end
107 awful
.button({ }, 5, function ()
108 awful
.client
.focus
.byidx(-1)
109 if client
.focus
then client
.focus
:raise() end
112 for s
= 1, screen
.count() do
113 -- Create a promptbox for each screen
114 mypromptbox
[s
] = awful
.widget
.prompt({ layout
= awful
.widget
.layout
.leftright
})
115 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
116 -- We need one layoutbox per screen.
117 mylayoutbox
[s
] = awful
.widget
.layoutbox(s
)
118 mylayoutbox
[s
]:buttons(awful
.util
.table.join(
119 awful
.button({ }, 1, function () awful
.layout
.inc(layouts
, 1) end),
120 awful
.button({ }, 3, function () awful
.layout
.inc(layouts
, -1) end),
121 awful
.button({ }, 4, function () awful
.layout
.inc(layouts
, 1) end),
122 awful
.button({ }, 5, function () awful
.layout
.inc(layouts
, -1) end)))
123 -- Create a taglist widget
124 mytaglist
[s
] = awful
.widget
.taglist(s
, awful
.widget
.taglist
.label
.all
, mytaglist
.buttons
)
126 -- Create a tasklist widget
127 mytasklist
[s
] = awful
.widget
.tasklist(function(c
)
128 return awful
.widget
.tasklist
.label
.currenttags(c
, s
)
129 end, mytasklist
.buttons
)
132 mywibox
[s
] = awful
.wibox({ position
= "top", screen
= s
})
133 -- Add widgets to the wibox - order matters
134 mywibox
[s
].widgets
= {
139 layout
= awful
.widget
.layout
.horizontal
.leftright
143 s
== 1 and mysystray
or nil,
145 layout
= awful
.widget
.layout
.horizontal
.rightleft
150 -- {{{ Mouse bindings
151 root
.buttons(awful
.util
.table.join(
152 awful
.button({ }, 3, function () mymainmenu
:toggle() end),
153 awful
.button({ }, 4, awful
.tag.viewnext
),
154 awful
.button({ }, 5, awful
.tag.viewprev
)
159 globalkeys
= awful
.util
.table.join(
160 awful
.key({ modkey
, }, "Left", awful
.tag.viewprev
),
161 awful
.key({ modkey
, }, "Right", awful
.tag.viewnext
),
162 awful
.key({ modkey
, }, "Escape", awful
.tag.history
.restore
),
164 awful
.key({ modkey
, }, "j",
166 awful
.client
.focus
.byidx( 1)
167 if client
.focus
then client
.focus
:raise() end
169 awful
.key({ modkey
, }, "k",
171 awful
.client
.focus
.byidx(-1)
172 if client
.focus
then client
.focus
:raise() end
174 awful
.key({ modkey
, }, "w", function () mymainmenu
:show(true) end),
176 -- Layout manipulation
177 awful
.key({ modkey
, "Shift" }, "j", function () awful
.client
.swap
.byidx( 1) end),
178 awful
.key({ modkey
, "Shift" }, "k", function () awful
.client
.swap
.byidx( -1) end),
179 awful
.key({ modkey
, "Control" }, "j", function () awful
.screen
.focus_relative( 1) end),
180 awful
.key({ modkey
, "Control" }, "k", function () awful
.screen
.focus_relative(-1) end),
181 awful
.key({ modkey
, }, "u", awful
.client
.urgent
.jumpto
),
182 awful
.key({ modkey
, }, "Tab",
184 awful
.client
.focus
.history
.previous()
191 awful
.key({ modkey
, }, "Return", function () awful
.util
.spawn(terminal
) end),
192 awful
.key({ modkey
, "Control" }, "r", awesome
.restart
),
193 awful
.key({ modkey
, "Shift" }, "q", awesome
.quit
),
195 awful
.key({ modkey
, }, "l", function () awful
.tag.incmwfact( 0.05) end),
196 awful
.key({ modkey
, }, "h", function () awful
.tag.incmwfact(-0.05) end),
197 awful
.key({ modkey
, "Shift" }, "h", function () awful
.tag.incnmaster( 1) end),
198 awful
.key({ modkey
, "Shift" }, "l", function () awful
.tag.incnmaster(-1) end),
199 awful
.key({ modkey
, "Control" }, "h", function () awful
.tag.incncol( 1) end),
200 awful
.key({ modkey
, "Control" }, "l", function () awful
.tag.incncol(-1) end),
201 awful
.key({ modkey
, }, "space", function () awful
.layout
.inc(layouts
, 1) end),
202 awful
.key({ modkey
, "Shift" }, "space", function () awful
.layout
.inc(layouts
, -1) end),
205 awful
.key({ modkey
}, "r", function () mypromptbox
[mouse
.screen
]:run() end),
207 awful
.key({ modkey
}, "x",
209 awful
.prompt
.run({ prompt
= "Run Lua code: " },
210 mypromptbox
[mouse
.screen
].widget
,
211 awful
.util
.eval
, nil,
212 awful
.util
.getdir("cache") .. "/history_eval")
216 -- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
217 clientkeys
= awful
.util
.table.join(
218 awful
.key({ modkey
, }, "f", function (c
) c
.fullscreen
= not c
.fullscreen
end),
219 awful
.key({ modkey
, "Shift" }, "c", function (c
) c
:kill() end),
220 awful
.key({ modkey
, "Control" }, "space", awful
.client
.floating
.toggle
),
221 awful
.key({ modkey
, "Control" }, "Return", function (c
) c
:swap(awful
.client
.getmaster()) end),
222 awful
.key({ modkey
, }, "o", awful
.client
.movetoscreen
),
223 awful
.key({ modkey
, "Shift" }, "r", function (c
) c
:redraw() end),
224 awful
.key({ modkey
,}, "m",
226 c
.maximized_horizontal
= not c
.maximized_horizontal
227 c
.maximized_vertical
= not c
.maximized_vertical
231 -- Compute the maximum number of digit we need, limited to 9
233 for s
= 1, screen
.count() do
234 keynumber
= math
.min(9, math
.max(#tags
[s
], keynumber
));
237 for i
= 1, keynumber
do
238 globalkeys
= awful
.util
.table.join(globalkeys
,
239 awful
.key({ modkey
}, i
,
241 local screen
= mouse
.screen
242 if tags
[screen
][i
] then
243 awful
.tag.viewonly(tags
[screen
][i
])
246 awful
.key({ modkey
, "Control" }, i
,
248 local screen
= mouse
.screen
249 if tags
[screen
][i
] then
250 tags
[screen
][i
].selected
= not tags
[screen
][i
].selected
253 awful
.key({ modkey
, "Shift" }, i
,
255 if client
.focus
and tags
[client
.focus
.screen
][i
] then
256 awful
.client
.movetotag(tags
[client
.focus
.screen
][i
])
259 awful
.key({ modkey
, "Control", "Shift" }, i
,
261 if client
.focus
and tags
[client
.focus
.screen
][i
] then
262 awful
.client
.toggletag(tags
[client
.focus
.screen
][i
])
267 clientbuttons
= awful
.util
.table.join(
268 awful
.button({ }, 1, function (c
) client
.focus
= c
; c
:raise() end),
269 awful
.button({ modkey
}, 1, awful
.mouse
.client
.move
),
270 awful
.button({ modkey
}, 3, awful
.mouse
.client
.resize
))
273 root
.keys(globalkeys
)
277 awful
.rules
.rules
= {
278 -- All clients will match this rule.
280 properties
= { border_width
= beautiful
.border_width
,
281 border_color
= beautiful
.border_normal
,
284 buttons
= clientbuttons
} },
285 { rule
= { class
= "MPlayer" },
286 properties
= { floating
= true } },
287 { rule
= { class
= "pinentry" },
288 properties
= { floating
= true } },
289 { rule
= { class
= "gimp" },
290 properties
= { floating
= true } },
291 -- Set Firefox to always map on tags number 2 of screen 1.
292 -- { rule = { instance = "Firefox" },
293 -- properties = { tag = tags[1][2] } },
298 -- Signal function to execute when a new client appears.
299 client
.add_signal("manage", function (c
, startup
)
300 -- If we are not managing this application at startup,
301 -- move it to the screen where the mouse is.
302 -- We only do it for filtered windows (i.e. no dock, etc).
303 if not startup
and awful
.client
.focus
.filter(c
) then
304 c
.screen
= mouse
.screen
308 -- awful.titlebar.add(c, { modkey = modkey })
310 -- Enable sloppy focus
311 c
:add_signal("mouse::enter", function(c
)
312 if awful
.layout
.get(c
.screen
) ~= awful
.layout
.suit
.magnifier
313 and awful
.client
.focus
.filter(c
) then
318 -- Set the windows at the slave,
319 -- i.e. put it at the end of others instead of setting it master.
320 -- awful.client.setslave(c)
323 client
.add_signal("focus", function(c
) c
.border_color
= beautiful
.border_focus
end)
324 client
.add_signal("unfocus", function(c
) c
.border_color
= beautiful
.border_normal
end)