tweaking my awesome rc.lua config file
It’s true, sometimes the title of my post try to be more as web search engine-friendly as possible…
Yesterday I was very unhappy of the new behavior of awesome. All of the sudden windows were not receiving focus automatically on screen change, forcing me to either use the mouse of to do some other keyboard action. so for the first time I decided to have a look at the awesome config file. At file I’ve to admit it’s a bit intimidating. I don’t know a word of lua and it’s syntax is not really intuitive.
First a word about my setup. I use xfce4 + awesome. I don’t want thunar of xfcedestop running and I don’t want the wibox bar hiding somewhere…
I’ll show highlight few chunks of the file. If interested, the whole file is attached to this post. I wrote only a small function, everything else are bit and pieces that I found on the net.
A bit debugging code that is actually very handy when trying to understand what is going on :
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
do
local in_error = false
awesome.add_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = err })
in_error = false
end)
end
A small function to raise one window in each screen when I move left
or right. This is actually not what I want, but it is better then
nothing. What I’d really like is to raise the window under the mouse
pointer. However the function awful.mouse.client_under_pointer
()
does not seem working as expected… so this is something I
want to fix sometimes in the future.
function myautofucus()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
local c = awful.mouse.client_under_pointer ()
if c then client.focus = c; c:raise() end
end
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, }, "Left", function () awful.tag.viewprev() ; myautofucus() end ),
awful.key({ modkey, }, "Right", function () awful.tag.viewnext() ; myautofucus() end ),
And then the rule I use to adjust different type of program I currently use. To get the class of a window you can use xprop .
-- {{{ Rules
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
buttons = clientbuttons,
size_hints_honor = false
} },
{ rule = { class = "MPlayer" },
properties = { floating = true } },
{ rule = { class = "pinentry" },
properties = { floating = true } },
{ rule = { class = "gimp" },
properties = { floating = true } },
{ rule = { class = "Chromium" },
properties = { tag = tags[1][8],
floating = true } },
{ rule = { class = "Iceweasel" },
properties = { tag = tags[1][2] } },
{ rule = { class = "Pidgin" },
properties = { tag = tags[1][7],
floating = true } },
{ rule = { class = "Skype" },
properties = { tag = tags[1][9],
floating = true } },
{ rule = { class = "Orage" },
properties = { floating = true } },
{ rule = { class = "Wicd-client.py" },
properties = { floating = true } },
{ rule = { instance = "plugin-container" },
properties = { floating = true } },
}
And this small bit is to remove the wibox :
a = awful.wibox()
a = nil
All in all lua is a nice language and awesome is a really flexible WM. Having the possibility to script its configuration file gives you unlimited space to experiment and automate boring and repetitive actions. Very nice :)