Monday, January 13, 2014

WindowMaker on Ubuntu 12.04, Part 1

Windowmaker was the first "proper" window manager I used on Linux, going back some 15 years ago. Since then, I've tried (and tried to love!) all manner of other window managers: KDE, Gnome, CDE (on Solaris and DEC)... Unity. It was that last one - Unity - that finally pushed me too far. I decided to go back to WindowMaker and see if I could make it workable. And you know what? I love it all over again.

There are a plethora of themes and style available for WindowMaker. In the end, I found myself drawn back to the default theme. Boring, huh? There are awesome themes everywhere out there, and trust me, I've tried a few lot of them in my time. I just like the plain old default :-)

Some things work perfectly

Login is almost instant - less than one second from entering my password till the time I have a usable desktop. That's pretty amazing for a basic business desktop computer with an oldish Core2 CPU.

WindowMaker is simple, stylish and beautifully retro. No desktop icons,  no system tray, no sidebars. Just bare desktop and some dock icons.

The same apps I used under KDE or Unity - they're all still there, and run just fine. Firefox, Thunderbird, gnome-terminal, amarok, gkrellm, nautilus... Getting them all in the menu... well, that took a little tweaking (see below).

Window Shade mode - god, I'd forgotten how much I love that! Double-click an application's title bar and it rolls up out of the way. Double click again and down it comes. It's like window minimising, but I find it far more useful.

Multimedia play/pause/skip keys still control amarok music player! (this I did not expect)

Some things have taken a bit of tweaking.

 

Screen locking

With small and curious kids in the house, I NEVER leave my desktop unlocked. With KDE, Gnome, Unity, that all automagically works. Not so on WindowMaker, so...

I used to use xlock(more) so I installed it and used it. However I got situations where it would not unlock again. The solution wasn't too hard: CTRL-ALT-F1 to jump to a text console, login and run

kill `ps axwu | grep [x]lock | awk '{print $2}'`

but really, that's not quite elegant. Instead, I followed these instructions to install xscreensaver instead. Then I created the file ~/GNUstep/Library/WindowMaker/autostart and added the following lines:

xscreensaver -nosplash &

You have to make autostart executable (finding that out took me a while!):

chmod u+x  ~/GNUstep/Library/WindowMaker/autostart

Then using WPrefs I edited the "Lock Screen" menu entry so that it reads:

xscreensaver-command -lock

I also configured xscreensaver by starting a terminal, and typing xscreensaver-demo

This allowed me to choose the Matrix screensaver. Hey, if I'm going back to the 90s, surely that's the screensaver of choice!

Some things have taken a fair bit of work to get operational.

 

Multimedia Volume keys

Under KDE/Gnome/Unity, these keys "automagically" work - in reality, there's an application, probably lurking in the system tray, which receives these keystrokes and adjusts the volume. I tried a few of the existing applets for WindowMaker, but none of them seemed to speak properly to Alsa. However alsa has a command-line client (amixer) which allows you to programatically control volumes. Put this together with xbindkeys to listen to the keystrokes, and hey pesto! (actually, it took a lot of doing, thanks to some buggy behaviour with un-muting Master channels). Here's what worked for me:

Install xbindkeys:

sudo apt-get install xbindkeys

create ~/.xbindkeysrc with these contents:

# (un)mute
"amixer -D pulse set Master toggle"
m:0x0 + c:121
# XF86AudioMute

# volume up
"amixer -c 0 set Master 5+ unmute"
m:0x0 + c:123
# XF86AudioRaiseVolume

# volume down
"amixer -c 0 set Master 5-"
m:0x0 + c:122
# XF86AudioLowerVolume

If these key bindings don't match yours, run xbindkey -k - this will open a window, press a key and you'll get the correct key-code to put in your own ~/.xbindkeysrc. Even more handy hints here. On my travels I also found this absolute corker of a site. Very very useful stuff there.

Run xbindkey and test. You can make xbindkeys re-read its config file with a HUP signal:

kill -HUP $(ps axwu | awk '$11 ~ /xbindkey/ {print $2}')

When your config is working, make sure you start xbindkeys on each login by adding it to ~/GNUstep/Library/WindowMaker/autostart. Don't forget the & at the end of the line. Update: that turns out to be unnecessary - even without that, xbindkeys is automagically running when I log in. It must hook into X when it starts, somehow.

Making volume controls start at preferred settings

Only a minor annoyance, but each time I'd log in to WindowMaker my alsa mixer (volume controls) would be at some semi-random state. Most annoyingly, this meant the internal speaker was on (ick!) and the external speakers weren't. The solution is to run alsamixer, get the controls set as you like them. Then use alsactl to store the settings, and alsactl restore to restore them on login. By default the store command will try to save the settings to /var/lib/alsa/asound.state which is not writable by regular users. You can either sudo to root to save to this file, or create your own asound.state in your home directory and use that. I chose the latter:

alsactl store -f ~/asound.state

Then in ~/GNUstep/Library/WindowMaker/autostart add the following:

alsactl restore -f ~/asound.state &

This approach means you could set up several sound profiles. I think this will come in useful for recording vs. playback, and probably a few other scenarios.

Some things... I still haven't got working to my satisfaction

Actually, having a few weeks off from work has allowed me to fritter away use my time to squash quite a few of the annoyances that I was going to write about in this section.

One that remains is that I still haven't found a The Ultimate Way to generate the Root menu (the menu that appears when you right-click the desktop) - specifically, how to generate a list of all installed applications that you'd want to use. The default one was in the old WindowMaker style, but WMPrefs (the editor that you would use to edit the menu) won't work with that format. So I had to generate a fresh WMRootMenu file in proplist format. I found wmgenmenu did pretty much what I wanted:

cd  ~/GNUstep/Defaults/
mv WMRootMenu WMRootMenu-old
wmgenmenu > WMRootMenu

It wasn't perfect, but it was a good start. I did a few edits to make things as I wanted them. I changed the screensaver/lock option (see above: Screen Locking)

I wanted to easily start up my "Usual Suspects" - a couple of gkrellms (one for localhost, one for the mythtv box) plus Thunderbird and Firefox. But I don't want my desktop startup delayed waiting for them, so I didn't put them in ~/GNUstep/Library/WindowMaker/autostart. Instead I created a small shell script in ~/bin:

#!/bin/bash

PATH=$PATH:/usr/bin

gkrellm&
gkrellm -s xx.xx.1.202 &
firefox&
thunderbird&


Then using WMPrefs, created a menu item to run that script:



I also added some applications that wmgenmenu didn't pick up automatically (netbeans, for example) and moved a few things around to where I wanted them - no point digging through 5 menu levels for something you use every day. Some really useful Gnome or KDE tools that I manually added or moved were k3b (CD burner), Nautilus (file manager of choice) and palimpsest (disk partition tool).

I also added a program shortcut to start a Windows XP VM: /usr/lib/virtualbox/VirtualBox --comment Windows XP --startvm --no-startvm-errormsgbox

There were definitely other things I did along the way - I might have to do a Part 2 to document them as I think of them. Watch this space.


No comments:

Post a Comment