Awesome WM config tweaks

I use Awesome WM which has made a splendid alternative to Gnome/Unity since soon after this was unleashed in Ubuntu 11.04. Not only did I find Unity to be dog-slow, I was finding windows were getting in the way more often than not. I had 8 virtual desktops and usually have active windows on 6 of them, and at first the Compiz navigation between them worked quite well. Then it all became very sub-standard with Unity…

I looked at alternatives and tried one or two of the lighter desktops, like Lubuntu which was fast and clean. But I felt drawn to the tiling window managers. I investigated dwm, xmonad quite deeply, but something about awesome drew me to it. So it got installed behind Gnome on a dying 32 but installation, and became a permanent feature on my day-to-day 64 bit install.

it’s taken a couple of months to decide what I wanted from it, and get things set up just right. But now I’ve got it working just as I want. So here’s a few config snippets that worked for me.

8 screens/tags/desktops helps me to stay organised. Skype and Thunderbird run on screen 1, Firefox and irssi on screen 2, NetBeans IDE on 3 on full screen, and I have 4 terminals open on screen 4 for SSHing and local tasks. I have pcmanfm on screen 5 which I allow to float between screens as, although it can take a parameter to open with a specific window classname, this is not flexible enough to open one fixed to a screen and to still allow other instances to open on other screens. VMs get run on screen 6, Chrome on 7, Transmission on 7 along with any video conversion work I have ongoing, and my daily selection of weird and wonderful music is on screen 9.

 tags = {
   names  = { "email", "www", "netbeans", "shells", "files", "vm", 'chrome', 'torrents', "music" },
   layout = { layouts[2], layouts[3], layouts[8], layouts[6], layouts[6],
              layouts[1], layouts[1], layouts[2], layouts[2]
 }}

I don’t use the menu, but have a link to Chrome on there for my wife, though she is getting quite adept at navigating with the keys.

mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu },
                                    { "main", debian.menu.Debian_menu.Debian },
    	 		            {"chrome", "google-chrome"},
                                    { "terminal", terminal }
                                  }
                        })

Added a calendar to the systray. i don’t go a lot on these sorts of things, but I am finding it useful. The calendar script is from http://awesome.naquadah.org/wiki/Calendar_widget

require('calendar2')
calendar2.addCalendarToWidget(mytextclock)

And because I work with people in other timezones, I’ve edited this to add a very simple world clock (that doesn’t change with DST because I live in a country that has no DST, and I can’t be bothered to do something more clever).

# Edit calendar2.lua at line 60
-- Show limited world clocks
	local format = " %a %b %d, %H:%M "

        local gmttime = os.time() - (3600 * 7)
	gmtdatetime = "GMT:" .. os.date(format, gmttime) .. "\n"

        local esttime = os.time() - (3600 * 12)
	estdatetime = "EST:" .. os.date(format, esttime)

        return header .. "\n" .. lines .. "\n\n" .. gmtdatetime .. estdatetime
end

I use dual languages, so need to allow for that, and just use an adapted script I found somewhere.

-- Keyboard map indicator and changer
kbdcfg = {}
kbdcfg.cmd = "setxkbmap"
kbdcfg.layout = { "us", "th" }
kbdcfg.current = 1  -- us is our default layout
kbdcfg.widget = widget({ type = "textbox", align = "right" })
kbdcfg.widget.text = string.upper( " " .. kbdcfg.layout[kbdcfg.current] .. " " )
kbdcfg.switch = function ()
   kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1
   local t = " " .. kbdcfg.layout[kbdcfg.current] .. " "
   kbdcfg.widget.text = string.upper( t )
   os.execute( kbdcfg.cmd .. t )
end

I have demu and pcmanfm bound to keys.

    awful.key({ modkey }, "p", function () awful.util.spawn("dmenu_run") end), 
    awful.key({ modkey }, "i", function () awful.util.spawn("pcmanfm") end),

And raise/lower the volume with the mod key and up/down in clientkeys.

    awful.key({ modkey }, "#111", 
	function () awful.util.spawn("amixer -q sset Master 2+", false) end),
    awful.key({ modkey }, "#116",
        function () awful.util.spawn("amixer -q sset Master 2-", false) end)

I map a number of applications to specific screens/tags in awful.rules.rules. Skype is always a slave window, and Thunderbird is always the master. this is fine for me as it’s rare I have more than one Skype chat open at once. Firefox download window floats.

     { rule = { class = "Firefox" },
       properties = { tag = tags[1][2] } },
     { rule = { class = "Chromium-browser" },
       properties = { tag = tags[1][7] } },
     { rule = { class = "Transmission" },
       properties = { tag = tags[1][8] } },
     { rule = { name = "NetBeans IDE 7.0.1" },
       properties = { tag = tags[1][3] } },
     { rule = { class = "Thunderbird" },
       properties = { tag = tags[1][1] } },
     { rule = { class = "Skype" },
       properties = { tag = tags[1][1] }, 
       callback = awful.client.setslave  },
     { rule = { instance = "Download" },
      properties = { floating = true }, },
     { rule = { class = "Deadbeef" },
      properties = { tag = tags[1][9] } },
     { rule = { name  = "irssi" },
      properties = { tag = tags[1][2] } },
     { rule = { name  = "SSH" },
      properties = { tag = tags[1][4] } },

Then at startup I load my usual apps, naming the windows in some cases so they will start up on the desired screens

awful.util.spawn("/home/mark/.conky/conkyall.sh")
awful.util.spawn("wmname LG3D")
awful.util.spawn("firefox");
awful.util.spawn("thunderbird");
awful.util.spawn("skype");
awful.util.spawn("transmission-gtk");
awful.util.spawn("netbeans");
awful.util.spawn("/home/mark/.dropbox-dist/dropboxd");
awful.util.spawn_with_shell("xmodmap /home/mark/.Xmodmap");
awful.util.spawn("deadbeef");
awful.util.spawn_with_shell("urxvt -e irssi");
awful.util.spawn_with_shell("urxvt -name SSH");
awful.util.spawn_with_shell("urxvt -name SSH");
awful.util.spawn_with_shell("urxvt -name SSH");
awful.util.spawn_with_shell("urxvt -name SSH");

And at the appropriate widths on screens where Skype or irssi are in the slave position.

awful.tag.setproperty(tags[1][1], "mwfact", 0.7)
awful.tag.setproperty(tags[1][2], "mwfact", 0.65)

The end result is that I sign on, and within about 10 seconds, nearly everything I need through the course of the day is ready for me. I like this very much!

  1. really helpful, thanks!

Reply to oukno ¬
Cancel reply


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>