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 :)


xfce4 and awsome

If you are tracking unstable, and you were using gnome2, then it’s futile to resist and not to move to gnome3. A lot has been written about gnome3, some poeple love it, others hate it. Others put their head under the sand by using the gnome3 fall-back mode. I’m on the “hate” category. I’ve used the fall-back mode for a while, then switched to the full blown gnome-shell and I’ve tried to use it for one month. I have to admit that is nice looking, intuitive and accessible. However it lacks so many things (gnome shell plug-ins are nice, but we still have to wait quite a while to have back all the fantastic gnome2 plug-ins) that I had in gnome2 that the new shiny look is not enough to keep me using it.

Moreover, apart for the very subjective reasons I gave above (I’m sure then other had different experiences and have a different pain threshold then I do), what I missed the most is the integration with awesome. I started using a tiling window manager last year and my productivity sky rocketed. Going back to manual window placement, overlapping, hiding, and this desperate continuous use of the “expose” functionality of gnome-shell was driving me mad.

So, since I started fresh with the new laptop, I looked around for alternatives. Going KDE is not an option. Many people say it’s nice and it works very well, but it’s not my cup of tea. Going back to gnome 2 was not really an option either. What I knew is that I wanted a desktop environment that is compatible with the freedesktop standards, modular and that would allow me to use my WM of choice.

The almost natural solution was to try xfce4. It seems to me a very nice desktop environment, light weight, extensible and with all the goodies I was looking for. The feeling is very much of gnome2. All components can work independently and it works very well with awesome.

Since i wanted a minimal subset of components I started by installing the xfce4 panel and awsome. This worked ok, but there were a lot of functionality missing, like plug-ins, notifications, automunting, integrations with consolekit, etc…

So after fighting a while, I’ve installed the full xcfe4 stack. Running awesome instead of the standard wm is just a matter of creating a custom session in the user preferences. On the awesome side, you need to disable the awesome panel and the awesome menu. This is all pretty easy and it was pretty much the same conf I used to have with gnome2.

I also tried to use slim as display manager. I’ve to say it works well, but fails to integrate with xfce4 and consolekit leaving me without the correct permissions. Looking for a replacement, I’ve tried ligthdm. This one more used then slim and intergrates perfectly with consolekit solving all my problems.

On very nice application that comes with xfce4 is thunar, their file manager and it integration with Ristretto, the image viewer. It always stuck me how eog and nautilus work badly together…

And since I was at it, I also dumped rhythmbox for listen and f-spot for shotwell . I like these two applications. They do their job well, they are stable (so far) and have all the functionalities I need. Bonus I finally go rid of mono !


awesome, GTD and other cool tools

Sometimes I think I’m a bit lazy to change my habits.

I’ve been looking at tiling window managers for a while, but I always failed to adopt one because of the big shift in habits it would have implied. This time, thanks to zack’s applet I decided to jump on the awesome bandwagon. And I’ve to say that I’m really happy about it. Since now I had never noticed how annoying was to move windows around. It is true that in the last year I’ve used guake as main console. Since it is a drop down and tabbed console, effectively it saved me the stress of placing a new window all the time I needed a new console. However there were still a lot of applications that were popping windows everywhere and I had no choice to find a place for them.

Awesome solves all these problems. Windows are positioned automatically. You can easily change from one layout to another using a key combination, it is very flexible (it’s configuration file is a program written in lua !!) and now thanks to zack’s applet is perfectly integrated with my gnome desktop. It basically replaces out of the box metacity (the default gnome window manager) just doing what awesome was meant to do : the window manager. You can disable all the extra features like the awesome panel and menus from the panel, and keep using gnome for everything else.

The other great tool I’ve just discovered thanks to an article on arstechnica is gtg . This is also a very handy tool. I’ve been using sticky notes for quite a while (both electronic and real ) but I’m far to be satisfied with it. I refuse to use tomboy as it uses mono and I prefer to avoid it (on religious grounds) . GTG follows the Get Things Done GTD methodology. At the end is just a friendly note taking tool with a lot plug-ins designed to be used with a keyboard. I’ve just started to use it and despite it already crashed on me few times I like it a lot.

Third and last (for this blog post) tool is a mind mapping tool. I’ve done mind mapping for a while : let’s say that I’m not a compulsive mind mapper but I enjoy putting things in place when I’ve time. In the past I’ve used freemind that is nice, but it crashed on me too many times. Alas, is written in java, and given my allergy to this language, I think this is just bad karma flowing in both directions… A couple of weeks ago I stumbled upon another mind mapping tool vym that is much more stable and a real pleasure to use. It didn’t crash once yet, it is very usable from the keyboard (essential when you are taking notes !) and it has a nice look & feel and a rich feature set. I’m happy it it.