"What good is having a large display if you’re constantly rearranging windows to fit them on the screen? I got tired of try to fit a web browser with other smaller windows and decided to try xmonad, a tiling window manager that could do this for me."I decided to give it a whirl. Having upgraded on release day to Ubuntu 9.04 "Jaunty Jackalope", I was suffering a little from "early adopter-ism" in that I couldn't find articles that showed me how to get it up and running.
The articles that I had amassed (See my references at the bottom of the post) were good enough to allow me to install Xmonad as a new session in GDM, I could login, spawn a terminal and get up and running.
sudo apt-get install xmonadEasy enough. But after years of being spoiled by Ubuntu's notifications, multimedia keys, WiFi config and just so much more that we take for granted, I could not go back to a plain X session with none of this jazz.
Initially I didn't care, Xmonad is so immediatly useful that I was prepared to forgo Gnome's shinys. However, it appears that Canonnical have deviated from the standard way of using X options that I couldn't get any startup applications to work, no matter where I put the commands. I tried .xsession, .gnomerc, modifying the xmonad.desktop GDM shortcut - all kinds of nasty hacks to no avail.
Then I found this page in the wiki, of how to replace Metacity (The Gnome window manger) with Xmonad. This seemed like a good compromise. However, none of the advice on the page (including the parts seemingly written for Jaunty) worked.
I finally got Xmonad working with two simple, simple lines in the Gnome "Sessions" app (Now called startup applications).
The first comand kills metacity,
killall metacityThe advice from the wiki suggests putting && xmonad at the end of this command, to launch Xmonad straight away, but this never worked. I could launch xmonad later though, which gave me the idea of delaying Xmonad:
sh -c "sleep 2 && xmonad"This is a little one-liner shellscript that waits for 2s before launching Xmonad.
And - Presto! - it works. A remarkably small amount of work for what was a whole evening's research.
A few tweaks make it nicer to use, I'll detail them here.
Here is my ~/xmonad.hs file:
import XMonadDon't ask me why they think a comma at the start of a line looks readable - it's their crazy standard not mine!
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.EwmhDesktops
import qualified XMonad.StackSet as W
myManageHook :: [ManageHook]
myManageHook =
[ resource =? "Do" --> doIgnore,
resource =? "gnome-do" --> doIgnore
]
main = xmonad $ defaultConfig
{ manageHook = manageDocks <+> composeAll myManageHook
, logHook = ewmhDesktopsLogHook
, terminal = "gnome-terminal"
, modMask = mod1Mask
, layoutHook = ewmhDesktopsLayout $ avoidStruts
$ layoutHook defaultConfig
}
So what do we have here, the imports and commands about "ManageDocks" stop it messing with gnome-panel, and I have added a few exclusions for gnome-do (If you don't use Do, you're wasting your life, same goes if you can't use Do because of an O/S limitation) so that Do doesn't get stretched out to fill a tiled window.
I use "mod1mask" for my mod key, left alt seems nicely under-thumb. gnome-terminal is an easy choice for gnome users, I add a little transparency to the mix (cpu based via xcompmgr).
There you have it, I hope you enjoy your new life, freed from having to minimize, maximize, resize and all that other screen fudge that you used to wade through hundreds of times a day!
EDIT (27/07/09) :
Blogger.com has destroyed the indentation, sorry. Look in the references for correct indentation (It's python-esque)
References
Original tombuntu post
http://tombuntu.com/index.php/2009/03/17/introduction-to-the-xmonad-tiling-window-manager/
Xmonad wiki
http://haskell.org/haskellwiki/Xmonad/Using_xmonad_in_Gnome
Ubuntu forums, "Tiling Window Manager (Xmonad) within Gnome with Gnome Do"
http://ubuntuforums.org/showthread.php?t=975329
I ran this exact same combination on an old beaten up Thinkpad with 512 ram which I got dead for $100 and brought back to life. Efficiency was imperative. Eventually, I cut out Gnome altogether (too crufty) and just ran plain Xmonad.
ReplyDeleteI became a master of the command line, but still, I got tired of having to configure my wireless that way every time I rebooted.
I saved time by avoiding pushing around the mouse, but typing commands was still adding precious seconds. I spent days trying to configure my Xmonad hotkeys, but the .config file is in Haskell and is a nightmare to understand. Who wants to learn Haskell just for one config file?
I then experimented with combining XFCE and Xmonad. The result was a good balance between speed and size, but XFCE is designed to be tightly integrated. It really wasn't meant to be used with Xmonad, and so, though it was efficient, it demonstrated some glitches (tiling my desktop, for one.) Despite this, my computer was faster than ever, because I could easily configure my hotkeys in XFCE to do whatever I wanted with one keypress.
Eventually the glitches bothered me. I discovered that Fluxbox can emulate a tiling WM quite well, and so I switched.
I now believe I have discovered the holy grail of WMs! My quest through the vagaries of Linux window managers is now complete. Fluxbox is incredibly fast. It starts in about one second, and has a footprint of about five megabytes. The hotkeys -and all other config options are easy to set up. They are in text files with names like ".keys," and are in plain English.
My crappy old computer, which someone had previously left for dead, is now running faster than ever before: faster, I believe, than any out of the box OS available today. Not bad for $100.
Recently I observed my friend using her macbook running OS X Leopard. When I (smartassedly) made a comment about how crufty her desktop was, she said "I don't care about ram, I have 4 gigs." "Yes," I said. "That is why you paid twelve-hundred dollars for it."
The bottom line: use Xmonad if you want to build your skills with the command line, or learn Haskell. If you don't want to do everything in command line, you will have to add Xmonad to a (crufty) DE, which defeats the purpose of using a lightweight window manager!
If you're interested in true efficiency, or like to tinker with your WM, just run Flux. It is very difficult to run Xmonad in a different environment without glitches, whereas Fluxbox practically invites you to take your favorite software from one place or another.
Either way, I see no reason to use Gnome. It's too bloated and slow! Do you really need those libraries and all those utilities? If you are not going to use all of the features of your DE, that's cruft. Even if you really do want to use a bloated Eyecandy DE, use KDE: it has more features, and Konqueror, the all-in-one file manager/web browser/terminal/program launcher.
Thanks for your comment, Dr. Doom, I would be very interested to hear of your experiences with getting WiFi to work without the gnome network manager?
ReplyDeleteI have had great success with tray applications like trayer, lxpanel, etc. They can be launched into a workspace that will never be used, and then nm-applet (gnome network manager) can be used to configure wifi.
ReplyDeleteHrushikesh, I did have a play with trayer, I'd forgotten the nm-applet was a program and not a gnome-panel applet (It was the name that confused me!) Maybe I'll set up a minimal install on my netbook...
ReplyDeleteThe real issue I had, is the inability to start programs after Xmonad starts - what's the best way to do this do you think?
I have a script which (among other things) starts nm-applet, trayer, gnome-settings-daemon(so that all my themes, fonts carry over). Part of it is:
ReplyDelete-----------
gnome-settings-daemon &
gnome-power-manager &
trayer --edge top --align center &
nm-applet &
-----------
Oh, if you mean you just have an empty desktop once you start xmonad - then you should probably map a keystroke for xterm/urxvt/something or start xterm from the console(Ctrl-Alt-F1) by using the command `DISPLAY=:0 xterm`. You might have to replace the :0 with your display.
ReplyDeleteThanks for that script, but what file should I call it from? I have no trouble running programs myself from within Xmonad, but it's how to get programs to *auto run* at startup that I'm interested in.
ReplyDeleteThanks!
Use startupHook. Look at the last post in http://bbs.archlinux.org/viewtopic.php?pid=543099
ReplyDeleteI don't use startupHook, but manually execute the script in xterm; because on reloading xmonad config (Mod-q), everything in startupHook gets executed once again, something that isn't desirable.
That sounds like a better way to connect to wireless from the command line. I also didn't realize the applet could be run from the command line. I'll have to try it. This is the way I was connecting:
ReplyDeletesudo iwlist eth1 scan
eth1 = the name of my wireless interface- yours will be different. This command will cause your wireless card to concatenate a list of networks that it is receiving. It basically gives you all the information that the applet does.
sudo iwconfig eth1 essid "[nameofwirelessnetwork]"
this command will connect you.
sudo dhclient
Finally, this command will ask your router to automatically assign you an IP address. Now you can browse the web.
Also, I would suggest, if you are already using gnome apps, you're using all those gnome libraries, so why not use gnome-terminal instead of xterm? It has more features.
Finally, if you're interested in scripting hotkeys, this might be useful to you:
http://linuxgazette.net/issue55/henderson.html
Hi,
ReplyDeleteWow that is an interesting concept, very complex. But it seems very effective. It would be fun to try it out and see what type of results you can get.
ddr