02 June 2007
Guerilla Computing
The title mem spawned in my mind as a result of two things. First, I finally tried a tiling window manager, after many people recommending it to me throughout the last year or two (most recently in the comments to “My Linux Stack”, thanks Torben!). Secondly, I didn’t have too much time recently to play with my setup, having high school final exams and getting back to work, so I found 900mb of updates waiting for me in portage.
Now, 900mb is a lot. A few years ago I had a pretty complete and useful Slackware setup on my old computer weighing 900mb. I choosed packages by hand, I used some advice from the Saving Space HOWTO, made ruthless decisions about what software I need and what not. Now, I have 12gb filled up on the partition with Gentoo. I wonder how much of it is garbage. I decided I don’t want it this way anymore and I don’t want to spend that much time on keeping up to date with the software, upgrading packages, fiddling with this stuff etc.
Anyway, the idea is to keep the set of the software you use as minimal and as portable as it gets - in guerilla you never know where you will wake up the next day if you wake up at all, and software certainly is one hell of a battlefield those days. The first step for me was kicking out XFCE and installing dwm, the tiling window manager I told you about in the beginning. Actually I installed a lot of tiling window managers, but this is the one I sticked with for now, as it’s so small it’s easy to learn and start using.
Dwm & dmenu are plain cool. Their compressed sources take up 27,121 bytes, yet they manage to make a better job managing windows and streamlining work than anything else I used. What makes dwm cool? Short version: tags and tiling. Basically, you define a set of tags for the things you’re doing with you computer, or for the programs you use, or whatever you will come up with. I currently have 8 major tags: “firefox”, “emacs”, “terminal”, “docs”, “chat”, “music”, “p2p” and “graphics”. Dwm lets you define which window should be tagged which tag. Now when you start it, you have a list of tags in the top bar and you can switch to a particular tag by pressing the shortcut of choice, Alt-1, Alt-2 etc. by default. You can also toggle a tag, for example to display both all the windows tagged “docs” and all the windows tagged “music”. When you have more than one window with the same tag, the display gets split, so the windows never overlap. One of the advantages of dwm is that it doesn’t have problems with floating windows - you can toggle a window between being tiled and floating, use whole workspaces containing only floating windows and finally you can resize/move windows, which isn’t always the case in titling WMs. The reason I finally took tiling window managers for a spin is that I recently found myself using a workspace consiting of fullscreen emacs on first desktop, fullscreen firefox on second desktop, maybe a maximized terminal running screen on the thrid one and everything else (being pretty much unimportant) floating around all the other workspaces. Using dwm was like capturing the pattern of usage into software and making it automatical.
A tiling window manager is like the ultimate answer to “distraction free” computing. If you look at the buzz from the MacOsX crowd about apps like WriteRoom, Backdrop, SpiritedAway etc. you can understand how a tiling wm can make sense. It just doesn’t have a cool logo and a good marketing campaign, but it realizes the same goal quite nicely.
Dmenu is 7,912 bytes and is a hell of a good application. The idea is dead simple, you give a list of options to the standard input, dmenu shows a bar on the top of the screen letting you choose an option using tab completion and substring matching and return the choosed option to the standard output. When someone says it’s like Quicksilver, you may think he’s nuts, as I first did. But hell, yes, it’s like Quicksilver made the unix way. It’s a simple tool, which power lies in the combination with other tools. The first thing I did with it and already used a hundred of times or so is selecting music to play. I bound Mod+Shift+m to the following command:
cd ~ && exec audacious "$((find downloads/ -name '*.mp3' && find music/) | dmenu)"
What id does is that it feeds dmenu with a list of loose mp3 in ~/downloads and all the music files and directories in ~/music. I can press the shortcut, type in the first few letters of the band / album / song I wanna play, press enter and audacious is going to play it. With a bit of fantasy you can do literally thousands of things this way. By using tools like xclip, which let you access the kill buffer from command line and a good scripting language or shell you can do thousands of _wicked cool_ things this way. When I realized this, the Quicksilver comparison didn’t seem that funny anymore.
Let’s see how we can achieve something more sophisticated using dmenu (or a simillar tool, the idea is important here, you can roll your own one without too much struggle). Let’s say we have an address book kept as a text file:
John Kowalsky <> Chuck Norris <> Elvis Presley <>
We would like to press a shortcut, select a person using dmenu and had a gmail “new message” page opened in firefox with the right data filled in. I never really used Quicksilver, but guessing from screencasts/articles, this is one of the common ways people use it. It’s not a big deal to implement this:
URL=$(echo -n "http://mail.google.com/mail/?view=cm&fs=1&to=" && \ (cat < addresses | dmenu)) firefox -remote "openUrl($URL)"
You make a shell script from this, bind it to a key and you have one more thing automatized. Using tools that let you access the X11 kill you could also implement easy adding of addresses to the text-file address book etc. Your imagination is the main limit here, the other being your knowledge of the shell, your scripting language of choice etc. Also remember you can nest dmenus to create something actually more reassembling a menu, without binding every single command to a keyboard shortcut.
What I want to achieve with my setup now is as much portability as you can get - I need an environment I can set up as quickly as possible on any modern computer no matter what. If my current box explodes, I want to be able to recreate the very same configuration in one day, nothing more. Currently, recreating my Gentoo setup would take a few weeks.
The next step I took after removing the bloated desktop environment is moving some of the activites to the web. I uninstalled Sage, putting my RSS feeds into Google Reader, and removed Sylpheed in favour of GMail and setting up forwarding from my second mail account. I always was and I still am a bit sceptical about web applications, but those two things I should have moved to the web long time ago. I’m only not sure about the Google, Che Guevara certainly wouldn’t like the idea of someone reading his e-mails. From the other side, they simply have the best products right now.
Now the basic stuff I spend most of my time in everyday looks like this:
Dwm, Emacs, Urxvt+Screen+Zsh, Firefox, Gmail, Greader, Ruby/Rails, Pidgin, Audacious
You may wonder about using pidgin or audacious in a tiling window manager, but in fact it works good enough. There is also obviously a whole lot of other apps I use and still need to pick down a bit, but the main set is compact enough. Now I’m trying to find a distribution that will make setting all this up as fast as possible… The first thing I come up is a Debian meta-package with all the software I need to get things done. After creating it, I would just install debian from a minimal installation CD, set up the internet connection, and install the metapackage. I have a separate partition for /home (one of the best Linux tips is to have one), so on my main box I wouldn’t even have to copy the configuration files. I was also thinking about checking out Arch Linux and OpenSuse, two distros I haven’t seen for a long time, but rising hope to not suck.
The nice thing is that all my major applications can tightly cooperate. Dwm takes the status bar content from Zsh, which for example checks Pidgin for new recieved messages, Dmenu can drive firefox using its remote interface, Emacs can send JavaScript to Firefox using MozRepl (thanks to Phil for this one!), Zsh can send a file to emacs using emacsclient etc. They are also extensible, what makes them the great apps they are. I could get even more from this setup, if I knew more JavaScript, shell magic, regular expressions, Lisp etc. It’s a nice motivation to expand your knowledge.
As always, here go the mandatory screenshots:
The whole setup is heavily influenced by various writing by various authors, make sure to checkout following articles/webpages if you’re curious:
- Suckless, the home of dwm, dmenu, wmii. You may also want to check out the mailing list and the irc channel (I got some very helpful advice there)
- “The Antidesktop” from freshmeat.net
- Various articles from Fravia searchlores.org (actually not those Linux related, this one is more about the spirit than about the technical details)
Comments ():
q, 15 October 2007, 12:14 am
what is “choosed”?
Mert, 22 December 2007, 6:20 pm
What distro you are using now?
stiff, 22 December 2007, 6:44 pm
Gentoo - but I’m not very up to date with the state of Linux distros.
szopa, 23 December 2007, 10:44 pm
Have you seen awesome (the window manager)? http://awesome.naquadah.org/
stiff, 24 December 2007, 10:20 am
I didn’t, yet it seems interesting… I will have to check it out, together with xmonad, which I also heard nice things about.
Caementum, 15 January 2008, 1:48 am
If you want to reduce the system even more look into one of the Linux liveCD’s.
Personally I use Puppy Linux installed to the hard drive. There is a script on the livecd that allows you to make your own custom livecd. I have most of my system ready on a livecd and the bootup time is about a minute and a half. (One minute of that time is copying the necessary files into a ramdisk.)
new york knicks tickets, 22 April 2011, 1:37 pm
Thanks for a brilliant effort in posting your article. One can be more informative like this.
Cute Messages, 7 May 2011, 1:18 pm
I have most of my system ready on a livecd and the bootup time is about a minute and a half.