Ethernet not working on Ubuntu with Realtek RTL8111/8168B

Thanks to rvdavid, the network on my new PC is now working, despite Ubuntu misrecognising it:

How to Get Gigabit Speeds from RTL8111/8168B PCI Express Gigabit Ethernet controller on Ubuntu Linux.

This is the kind of thing I had to do 10 years ago. I thought we’d moved on…

Entertain your baby using your Android phone

Last night my friend and I uploaded the first version of Baby Distraction, an Android app featuring charming cartoon animals, vibration and sounds.

I helped almost exclusively in an advisory capacity, but still am inexplicably proud of the result: it’s incredibly simple, but polished, and, most importantly, their baby loves it.

This morning I searched for “baby games” on the Android Marketplace, and it was the top hit. Fame and fortune await.

rdesktop swallows keyboard events

The Linux remote desktop client rdesktop grabs all keyboard events by default, which is good, because it allows e.g. you to Alt-Tab between applications and Ctrl-Alt-Del as if you were in front of the remote machine.

However, it is also bad because you can’t use the standard keyboard shortcuts to switch between virtual desktops. Varius Googling had convinced me that this problem was not soluble, since X only provides a global keyboard-grabbing function XGrabKeyboard, and once the event has been grabbed and fed to rdesktop, there doesn’t appear to be a way to re-emit it back up to the window manager so that it can be used to switch desktops.

Kudos to Sunner, therefore, for coming up with a workaround. It’s really simple: you have to press the key twice, and the first time, rdesktop simply ungrabs the keyboard. The second time, the window manager receives the event as normal.

Here’s my version of Sunner’s patch, against rdesktop 1.6.0. It removes Alt-Tab support since I don’t need that, and adds Ctrl-Alt-Up and -Down, because I do need those:

--- rdesktop-1.6.0/xkeymap.c	2011-07-06 12:49:01.000000000 +0100
+++ rdesktop-1.6.0-mod/xkeymap.c	2011-07-06 11:40:24.000000000 +0100
@@ -598,6 +598,25 @@
 				ui_seamless_toggle();
 			break;
 
+		case XK_Left:
+		case XK_Right:
+		case XK_Up:
+		case XK_Down:
+			if ((get_key_state(state, XK_Alt_L) || get_key_state(state, XK_Alt_R))
+					&& (get_key_state(state, XK_Control_L)
+						|| get_key_state(state, XK_Control_R)))
+			{
+				/* Ctrl-Alt-Left/Right/Up/Down:
+				 * Ungrab the keyboard so that user can use Windows manager's hot keys */
+				extern RD_BOOL g_fullscreen;
+				if (g_fullscreen) { /* Turn to normal window. Otherwise, rdesktop will be always on top */
+					xwin_toggle_fullscreen();
+				}
+
+				XUngrabKeyboard(g_display, CurrentTime);
+				return True;
+			}
+			break;
 	}
 	return False;
 }

(Download it here: rdesktop-1.6.0-ungrab-on-ctrl-alt-direction.patch)

And as usual here is how to patch your Ubuntu system to include this patch:

sudo apt-get install build-essential fakeroot dpkg-dev
sudo apt-get build-dep rdesktop
mkdir tmp
cd tmp
apt-get source rdesktop
cd rdesktop-*
wget http://www.artificialworlds.net/blog/wp-content/uploads/rdesktop-1.6.0-ungrab-on-ctrl-alt-direction.patch
patch -p1 < rdesktop-1.6.0-ungrab-on-ctrl-alt-direction.patch
dpkg-buildpackage -rfakeroot -b
cd ..
sudo dpkg -i rdesktop*.deb

Now someone just needs to add support for reading your window manager settings to determine automatically what shortcuts you use to switch desktops, and/or support for a config file listing keys that make rdesktop ungrab the keyboard.

Reclaiming desktop space with Ubuntu’s window-picker-applet

For a long time I’ve customised GNOME to have a vertical task bar on the left and launcher buttons across the top. I’ve struggled with a long-standing bug with using a vertical panel, and I’ve sacrificed quite a lot of screen space to make enough room to see the window titles.

Recently I’ve found myself using smaller screens, and finding certain aspects of the Ubuntu Netbook Remix quite good. In particular, I like the combination of Maximus and window-picker-applet, which I combine with GNOME Do. This setup allows me to have almost all of my screen set aside for programs I am using, without feeling lost or inconvenienced.

I need one setting to prevent Maximus from automatically maximising windows – I just want it to remove the title bar when a window is maximised, because window-picker-applet shows the title in my panel instead:

gconftool –type bool –set /apps/maximus/no_maximize true

and then I add Maximus to my Startup Applications (Click Add, give it a name, and set command to “maximus”), and set GNOME Do’s “Start GNOME Do at login” preference (the Preferences screen can be found on the drop-down at the top right of the GNOME Do window).

Now I am happy, except for a little bug fix and visual tweak I want for window-picker-applet. The relevant bugs are Bug #425813 (see my patch at the bottom) and Bug #798197. On an Ubuntu system it’s amazingly easy to use a patched version:

sudo apt-get install build-essential fakeroot dpkg-dev
sudo apt-get build-dep window-picker-applet
mkdir tmp
cd tmp
apt-get source window-picker-applet
cd window-picker-applet-*
wget http://bugs.launchpad.net/ubuntu/+source/window-picker-applet/+bug/798197/+attachment/2171550/+files/show-windows-requring-attention-on-all-workspaces.patch
patch -p1 < show-windows-requring-attention-on-all-workspaces.patch wget http://bugs.launchpad.net/ubuntu/+source/window-picker-applet/+bug/425813/+attachment/2171630/+files/faster-deeper-attention-flash.patch patch -p1 < faster-deeper-attention-flash.patch dpkg-buildpackage -rfakeroot -b cd .. sudo dpkg -i window-picker-applet_*.deb killall gnome-panel