The Wrong Question: Using Ubuntu With Your Favourite WM

So as I mentioned before, I’ve been using Ubuntu with window managers other than GNOME.  But there are some things I took for granted about GNOME, such as the way that it automatically connects to my preferred wireless networks, or the way that it suspends my laptop when I close it.  So I tried to find how to do those things without running GNOME, and eventually, after asking Google the wrong questions, I discovered that it’s really quite easy.

Connecting to Wireless Networks

The wrong question: How do I connect to a WPA2 wireless network from the command line in Linux?

The real question: How do I connect to a WPA2 wireless network in i3 (or wmii, or your favourite window manager) running on Ubuntu?

While there is an answer to the command-line question, there is an easier way.  I’ve found that I can just tell my window manager to run the following command when it starts:

nm-applet &

The NetworkManager process is already running in Ubuntu (perhaps because we’re running under GDM as our login manager).  If you’ve set up wireless networks while using GNOME, the network manager applet (nm-applet) talks to the NetworkManager, and when a known wireless network is detected, nm-applet instructs NetworkManager to connect.

Suspending, Hibernating & Advanced Power Management

The wrong question: How do I suspend my laptop in Ubuntu from the command line?

The real question: How do I set things up so that I can quickly suspend my laptop in my favourite non-GNOME window manager running on Ubuntu?

As with the previous question, this turns out to be very simple, again perhaps because on Ubuntu we’re running under GDM.  Simply tell your window manager to run the following command on initialisation:

gnome-power-manager &

Now when you close your laptop, it will suspend.  Or not suspend if you’ve set things differently.  To change the settings, use the following command:


Storing Passwords

On Ubuntu, you are running under GDM.  So the GNOME keyring daemon should be running on your system.  With some software like Adobe AIR, you just need to fool the software into thinking GNOME is running so that it tries to talk to the GNOME keyring.


Ssh-agent Authentication

It seems that on Ubuntu GNOME automatically adds your RSA/DSA identity to the authentication agent (ssh-agent).  If this is a feature you used with GNOME and are missing in your current window manager, simply add this command to your window manager’s initialisation script:


Last Resort: Running GNOME Too

While I was figuring out how to do these things, I did some messing around using a trick I learnt from the Linux Journal: running multiple window managers at once.  Before narrowing the networking thing to nm-applet, I found that if I run GNOME on a separate display from i3, I would still get the benefits of GNOME’s wireless network detection.  Perhaps if you’re missing something else from GNOME, this could help you.  Simply switch to a virtual terminal using Ctrl+Alt+F1.  Log in with your normal username, then type:

startx -- :1

Or, if you want to specify which window manager to run (in this example, i3), try:

xinit /usr/bin/i3 -- :1

Now you can use Ctrl+Alt+F7 to switch to the window manager you were already running (display :0), and Ctrl+Alt+F8 to switch to the one you’ve just started (display :1).

This entry was posted in midlength and tagged , , , , , , , , , . Bookmark the permalink.

Comments are closed.