1 -- Standard awesome library
3 require("awful.autofocus")
4 -- Theme handling library
6 -- Notification library
9 -- {{{ Variable definitions
10 -- Themes define colours, icons, and wallpapers
11 -- The default is a dark theme
12 theme_path
= "@AWESOME_THEMES_PATH@/default/theme.lua"
13 -- Uncommment this for a lighter theme
14 -- theme_path = "@AWESOME_THEMES_PATH@/sky/theme.lua"
16 -- Actually load theme
17 beautiful
.init(theme_path
)
19 -- This is used later as the default terminal and editor to run.
21 editor
= os
.getenv("EDITOR") or "nano"
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
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 -- xterm -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 { name
= 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 textclock widget
94 mytextclock
= awful
.widget
.textclock({ align
= "right" })
96 -- Create a laucher widget and a main menu
98 { "manual", terminal
.. " -e man awesome" },
99 { "edit config", editor_cmd
.. " " .. awful
.util
.getdir("config") .. "/rc.lua" },
100 { "restart", awesome
.restart
},
101 { "quit", awesome
.quit
}
104 mymainmenu
= awful
.menu({ items
= { { "awesome", myawesomemenu
, beautiful
.awesome_icon
},
105 { "open terminal", terminal
}
109 mylauncher
= awful
.widget
.launcher({ image
= image(beautiful
.awesome_icon
),
113 mysystray
= widget({ type = "systray" })
115 -- Create a wibox for each screen and add it
120 mytaglist
.buttons
= awful
.util
.table.join(
121 awful
.button({ }, 1, awful
.tag.viewonly
),
122 awful
.button({ modkey
}, 1, awful
.client
.movetotag
),
123 awful
.button({ }, 3, function (tag) tag.selected
= not tag.selected
end),
124 awful
.button({ modkey
}, 3, awful
.client
.toggletag
),
125 awful
.button({ }, 4, awful
.tag.viewnext
),
126 awful
.button({ }, 5, awful
.tag.viewprev
)
129 mytasklist
.buttons
= awful
.util
.table.join(
130 awful
.button({ }, 1, function (c
)
131 if not c
:isvisible() then
132 awful
.tag.viewonly(c
:tags()[1])
137 awful
.button({ }, 3, function ()
142 instance
= awful
.menu
.clients({ width
=250 })
145 awful
.button({ }, 4, function ()
146 awful
.client
.focus
.byidx(1)
147 if client
.focus
then client
.focus
:raise() end
149 awful
.button({ }, 5, function ()
150 awful
.client
.focus
.byidx(-1)
151 if client
.focus
then client
.focus
:raise() end
154 for s
= 1, screen
.count() do
155 -- Create a promptbox for each screen
156 mypromptbox
[s
] = awful
.widget
.prompt({ layout
= awful
.widget
.layout
.leftright
})
157 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
158 -- We need one layoutbox per screen.
159 mylayoutbox
[s
] = awful
.widget
.layoutbox(s
)
160 mylayoutbox
[s
]:buttons(awful
.util
.table.join(
161 awful
.button({ }, 1, function () awful
.layout
.inc(layouts
, 1) end),
162 awful
.button({ }, 3, function () awful
.layout
.inc(layouts
, -1) end),
163 awful
.button({ }, 4, function () awful
.layout
.inc(layouts
, 1) end),
164 awful
.button({ }, 5, function () awful
.layout
.inc(layouts
, -1) end)))
165 -- Create a taglist widget
166 mytaglist
[s
] = awful
.widget
.taglist(s
, awful
.widget
.taglist
.label
.all
, mytaglist
.buttons
)
168 -- Create a tasklist widget
169 mytasklist
[s
] = awful
.widget
.tasklist(function(c
)
170 return awful
.widget
.tasklist
.label
.currenttags(c
, s
)
171 end, mytasklist
.buttons
)
174 mywibox
[s
] = awful
.wibox({ position
= "top", screen
= s
})
175 -- Add widgets to the wibox - order matters
176 mywibox
[s
].widgets
= {
181 layout
= awful
.widget
.layout
.horizontal
.leftright
185 s
== 1 and mysystray
or nil,
187 layout
= awful
.widget
.layout
.horizontal
.rightleft
192 -- {{{ Mouse bindings
193 root
.buttons(awful
.util
.table.join(
194 awful
.button({ }, 3, function () mymainmenu
:toggle() end),
195 awful
.button({ }, 4, awful
.tag.viewnext
),
196 awful
.button({ }, 5, awful
.tag.viewprev
)
201 globalkeys
= awful
.util
.table.join(
202 awful
.key({ modkey
, }, "Left", awful
.tag.viewprev
),
203 awful
.key({ modkey
, }, "Right", awful
.tag.viewnext
),
204 awful
.key({ modkey
, }, "Escape", awful
.tag.history
.restore
),
206 awful
.key({ modkey
, }, "j",
208 awful
.client
.focus
.byidx( 1)
209 if client
.focus
then client
.focus
:raise() end
211 awful
.key({ modkey
, }, "k",
213 awful
.client
.focus
.byidx(-1)
214 if client
.focus
then client
.focus
:raise() end
216 awful
.key({ modkey
, }, "w", function () mymainmenu
:show(true) end),
218 -- Layout manipulation
219 awful
.key({ modkey
, "Shift" }, "j", function () awful
.client
.swap
.byidx( 1) end),
220 awful
.key({ modkey
, "Shift" }, "k", function () awful
.client
.swap
.byidx( -1) end),
221 awful
.key({ modkey
, "Control" }, "j", function () awful
.screen
.focus( 1) end),
222 awful
.key({ modkey
, "Control" }, "k", function () awful
.screen
.focus(-1) end),
223 awful
.key({ modkey
, }, "u", awful
.client
.urgent
.jumpto
),
224 awful
.key({ modkey
, }, "Tab",
226 awful
.client
.focus
.history
.previous()
233 awful
.key({ modkey
, }, "Return", function () awful
.util
.spawn(terminal
) end),
234 awful
.key({ modkey
, "Control" }, "r", awesome
.restart
),
235 awful
.key({ modkey
, "Shift" }, "q", awesome
.quit
),
237 awful
.key({ modkey
, }, "l", function () awful
.tag.incmwfact( 0.05) end),
238 awful
.key({ modkey
, }, "h", function () awful
.tag.incmwfact(-0.05) end),
239 awful
.key({ modkey
, "Shift" }, "h", function () awful
.tag.incnmaster( 1) end),
240 awful
.key({ modkey
, "Shift" }, "l", function () awful
.tag.incnmaster(-1) end),
241 awful
.key({ modkey
, "Control" }, "h", function () awful
.tag.incncol( 1) end),
242 awful
.key({ modkey
, "Control" }, "l", function () awful
.tag.incncol(-1) end),
243 awful
.key({ modkey
, }, "space", function () awful
.layout
.inc(layouts
, 1) end),
244 awful
.key({ modkey
, "Shift" }, "space", function () awful
.layout
.inc(layouts
, -1) end),
247 awful
.key({ modkey
}, "r", function () mypromptbox
[mouse
.screen
]:run() end),
249 awful
.key({ modkey
}, "x",
251 awful
.prompt
.run({ prompt
= "Run Lua code: " },
252 mypromptbox
[mouse
.screen
].widget
,
253 awful
.util
.eval
, nil,
254 awful
.util
.getdir("cache") .. "/history_eval")
258 -- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
259 clientkeys
= awful
.util
.table.join(
260 awful
.key({ modkey
, }, "f", function (c
) c
.fullscreen
= not c
.fullscreen
end),
261 awful
.key({ modkey
, "Shift" }, "c", function (c
) c
:kill() end),
262 awful
.key({ modkey
, "Control" }, "space", awful
.client
.floating
.toggle
),
263 awful
.key({ modkey
, "Control" }, "Return", function (c
) c
:swap(awful
.client
.getmaster()) end),
264 awful
.key({ modkey
, }, "o", awful
.client
.movetoscreen
),
265 awful
.key({ modkey
, "Shift" }, "r", function (c
) c
:redraw() end),
266 awful
.key({ modkey
,}, "m",
268 c
.maximized_horizontal
= not c
.maximized_horizontal
269 c
.maximized_vertical
= not c
.maximized_vertical
273 -- Compute the maximum number of digit we need, limited to 9
275 for s
= 1, screen
.count() do
276 keynumber
= math
.min(9, math
.max(#tags
[s
], keynumber
));
279 for i
= 1, keynumber
do
280 globalkeys
= awful
.util
.table.join(globalkeys
,
281 awful
.key({ modkey
}, i
,
283 local screen
= mouse
.screen
284 if tags
[screen
][i
] then
285 awful
.tag.viewonly(tags
[screen
][i
])
288 awful
.key({ modkey
, "Control" }, i
,
290 local screen
= mouse
.screen
291 if tags
[screen
][i
] then
292 tags
[screen
][i
].selected
= not tags
[screen
][i
].selected
295 awful
.key({ modkey
, "Shift" }, i
,
297 if client
.focus
and tags
[client
.focus
.screen
][i
] then
298 awful
.client
.movetotag(tags
[client
.focus
.screen
][i
])
301 awful
.key({ modkey
, "Control", "Shift" }, i
,
303 if client
.focus
and tags
[client
.focus
.screen
][i
] then
304 awful
.client
.toggletag(tags
[client
.focus
.screen
][i
])
310 root
.keys(globalkeys
)
314 -- Signal function to execute when a new client appears.
315 client
.add_signal("manage", function (c
, startup
)
316 -- If we are not managing this application at startup,
317 -- move it to the screen where the mouse is.
318 -- We only do it for filtered windows (i.e. no dock, etc).
319 if not startup
and awful
.client
.focus
.filter(c
) then
320 c
.screen
= mouse
.screen
325 awful
.titlebar
.add(c
, { modkey
= modkey
})
327 -- Add mouse bindings
328 c
:buttons(awful
.util
.table.join(
329 awful
.button({ }, 1, function (c
) client
.focus
= c
; c
:raise() end),
330 awful
.button({ modkey
}, 1, awful
.mouse
.client
.move
),
331 awful
.button({ modkey
}, 3, awful
.mouse
.client
.resize
)
333 -- New client may not receive focus
334 -- if they're not focusable, so set border anyway.
335 c
.border_width
= beautiful
.border_width
336 c
.border_color
= beautiful
.border_normal
338 -- Check if the application should be floating.
340 local inst
= c
.instance
341 if floatapps
[cls
] ~= nil then
342 awful
.client
.floating
.set(c
, floatapps
[cls
])
343 elseif floatapps
[inst
] ~= nil then
344 awful
.client
.floating
.set(c
, floatapps
[inst
])
347 -- Check application->screen/tag mappings.
350 target
= apptags
[cls
]
351 elseif apptags
[inst
] then
352 target
= apptags
[inst
]
355 c
.screen
= target
.screen
356 awful
.client
.movetotag(tags
[target
.screen
][target
.tag], c
)
359 -- Do this after tag mapping, so you don't see it on the wrong tag for a split second.
365 -- Enable sloppy focus
366 c
:add_signal("mouse::enter", function(c
)
367 if awful
.layout
.get(c
.screen
) ~= awful
.layout
.suit
.magnifier
368 and awful
.client
.focus
.filter(c
) then
373 -- Set the windows at the slave,
374 -- i.e. put it at the end of others instead of setting it master.
375 -- awful.client.setslave(c)
377 -- Honor size hints: if you want to drop the gaps between windows, set this to false.
378 -- c.size_hints_honor = false