<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andy Balaam's Blog &#187; GNOME</title>
	<atom:link href="http://www.artificialworlds.net/blog/category/gnome/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.artificialworlds.net/blog</link>
	<description>Four in the morning, still writing Free Software</description>
	<lastBuildDate>Sat, 21 Jan 2012 08:22:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>rdesktop swallows keyboard events</title>
		<link>http://www.artificialworlds.net/blog/2011/07/06/rdesktop-swallows-keyboard-events/</link>
		<comments>http://www.artificialworlds.net/blog/2011/07/06/rdesktop-swallows-keyboard-events/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 12:03:04 +0000</pubDate>
		<dc:creator>Andy Balaam</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.artificialworlds.net/blog/?p=461</guid>
		<description><![CDATA[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&#8217;t use the standard keyboard shortcuts to switch between virtual desktops. Varius [...]]]></description>
			<content:encoded><![CDATA[<p>The Linux remote desktop client <a href="http://www.rdesktop.org/">rdesktop</a> 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.</p>
<p>However, it is also bad because you can&#8217;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 <a href="http://www.xfree86.org/current/XGrabKeyboard.3.html">XGrabKeyboard</a>, and once the event has been grabbed and fed to rdesktop, there doesn&#8217;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.</p>
<p>Kudos to <a href="http://sunner.cn/">Sunner</a>, therefore, for coming up with a <a href="http://blog.sunner.cn/rdesktop-patch-switch-local-workspaces-and-windows-by-local-hot-keys/">workaround</a>.  It&#8217;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.</p>
<p>Here&#8217;s my version of Sunner&#8217;s patch, against rdesktop 1.6.0.  It removes Alt-Tab support since I don&#8217;t need that, and adds Ctrl-Alt-Up and -Down, because I do need those:</p>
<pre>--- 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))
+					&#038;&#038; (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;
 }</pre>
<p>(Download it here: <a href="http://www.artificialworlds.net/blog/wp-content/uploads/rdesktop-1.6.0-ungrab-on-ctrl-alt-direction.patch">rdesktop-1.6.0-ungrab-on-ctrl-alt-direction.patch</a>)</p>
<p>And as usual here is how to patch your Ubuntu system to include this patch:</p>
<div class="code">sudo apt-get install build-essential fakeroot dpkg-dev<br />
sudo apt-get build-dep rdesktop<br />
mkdir tmp<br />
cd tmp<br />
apt-get source rdesktop<br />
cd rdesktop-*<br />
wget http://www.artificialworlds.net/blog/wp-content/uploads/rdesktop-1.6.0-ungrab-on-ctrl-alt-direction.patch<br />
patch -p1 < rdesktop-1.6.0-ungrab-on-ctrl-alt-direction.patch<br />
dpkg-buildpackage -rfakeroot -b<br />
cd ..<br />
sudo dpkg -i rdesktop*.deb</div>
<p>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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.artificialworlds.net/blog/2011/07/06/rdesktop-swallows-keyboard-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reclaiming desktop space with Ubuntu&#8217;s window-picker-applet</title>
		<link>http://www.artificialworlds.net/blog/2011/06/16/reclaiming-desktop-space-with-ubuntus-window-picker-applet/</link>
		<comments>http://www.artificialworlds.net/blog/2011/06/16/reclaiming-desktop-space-with-ubuntus-window-picker-applet/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 14:15:16 +0000</pubDate>
		<dc:creator>Andy Balaam</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.artificialworlds.net/blog/?p=447</guid>
		<description><![CDATA[For a long time I&#8217;ve customised GNOME to have a vertical task bar on the left and launcher buttons across the top. I&#8217;ve struggled with a long-standing bug with using a vertical panel, and I&#8217;ve sacrificed quite a lot of screen space to make enough room to see the window titles. Recently I&#8217;ve found myself [...]]]></description>
			<content:encoded><![CDATA[<p>For a long time I&#8217;ve customised GNOME to have a vertical task bar on the left and launcher buttons across the top.  I&#8217;ve struggled with a <a href="http://www.artificialworlds.net/blog/2008/12/10/fixing-the-vertical-panel-window-list-on-ubuntu-hardy/">long-standing bug with using a vertical panel</a>, and I&#8217;ve sacrificed quite a lot of screen space to make enough room to see the window titles.</p>
<p>Recently I&#8217;ve found myself using smaller screens, and finding certain aspects of the <a href="https://wiki.ubuntu.com/UNR">Ubuntu Netbook Remix</a> quite good.  In particular, I like the combination of <a href="https://launchpad.net/maximus">Maximus</a> and <a href="https://launchpad.net/window-picker-applet">window-picker-applet</a>, which I combine with <a href="http://do.davebsd.com/">GNOME Do</a>.  This setup allows me to have almost all of my screen set aside for programs I am using, without feeling lost or inconvenienced.</p>
<p>I need one setting to prevent Maximus from automatically maximising windows &#8211; 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:</p>
<div class="code">gconftool &#8211;type bool &#8211;set /apps/maximus/no_maximize true</div>
<p>and then I add Maximus to my Startup Applications (Click Add, give it a name, and set command to &#8220;maximus&#8221;), and set GNOME Do&#8217;s &#8220;Start GNOME Do at login&#8221; preference (the Preferences screen can be found on the drop-down at the top right of the GNOME Do window).</p>
<p>Now I am happy, except for a little bug fix and visual tweak I want for window-picker-applet.  The relevant bugs are <a href="http://bugs.launchpad.net/ubuntu/+source/window-picker-applet/+bug/425813">Bug #425813</a> (see my patch at the bottom) and <a href="http://bugs.launchpad.net/ubuntu/+source/window-picker-applet/+bug/798197">Bug #798197</a>.  On an Ubuntu system it&#8217;s amazingly easy to use a patched version:</p>
<div class="code">sudo apt-get install build-essential fakeroot dpkg-dev<br />
sudo apt-get build-dep window-picker-applet<br />
mkdir tmp<br />
cd tmp<br />
apt-get source window-picker-applet<br />
cd window-picker-applet-*<br />
wget http://bugs.launchpad.net/ubuntu/+source/window-picker-applet/+bug/798197/+attachment/2171550/+files/show-windows-requring-attention-on-all-workspaces.patch<br />
patch -p1 < show-windows-requring-attention-on-all-workspaces.patch<br />
wget http://bugs.launchpad.net/ubuntu/+source/window-picker-applet/+bug/425813/+attachment/2171630/+files/faster-deeper-attention-flash.patch<br />
patch -p1 < faster-deeper-attention-flash.patch<br />
dpkg-buildpackage -rfakeroot -b<br />
cd ..<br />
sudo dpkg -i window-picker-applet_*.deb<br />
killall gnome-panel</div>
]]></content:encoded>
			<wfw:commentRss>http://www.artificialworlds.net/blog/2011/06/16/reclaiming-desktop-space-with-ubuntus-window-picker-applet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switching workspace in GNOME via the command line</title>
		<link>http://www.artificialworlds.net/blog/2011/03/04/switching-workspace-in-gnome-via-the-command-line/</link>
		<comments>http://www.artificialworlds.net/blog/2011/03/04/switching-workspace-in-gnome-via-the-command-line/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 17:09:42 +0000</pubDate>
		<dc:creator>Andy Balaam</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.artificialworlds.net/blog/?p=426</guid>
		<description><![CDATA[I use rdesktop to connect to some Windows machines, and it works beautifully. I like to allow it to grab keyboard input so I can switch and close windows on my Windows desktop without fear of accidentally doing something to the rest of my Linux desktop. However, I have never found a way of letting [...]]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://www.rdesktop.org/">rdesktop</a> to connect to some Windows machines, and it works beautifully.  I like to allow it to grab keyboard input so I can switch and close windows on my Windows desktop without fear of accidentally doing something to the rest of my Linux desktop.</p>
<p>However, I have never found a way of letting some keystrokes escape &#8211; specifically Ctrl-Alt-Left, Right, Up, Down so that I can switch workspaces (virtual desktops) away from the workspace containing rdesktop.</p>
<p>I have finally found what I hope is a good workaround &#8211; I have installed <a href="http://sourceforge.net/apps/trac/easystroke/wiki">easystroke</a> and defined some mouse gestures I can use to switch desktop.  These mouse gestures are not swallowed by rdesktop, so they still work, even when it has focus.</p>
<p>When I asked easystroke to send the Ctrl-Alt-Left etc. keystrokes, they got swallowed by rdesktop, so all I needed to be able to do complete the story was a command-line tool to switch workspace.</p>
<p>That turned out to be trickier than you might imagine, but here is my solution, using the amazing <a href="http://tomas.styblo.name/wmctrl/">wmctrl</a>.</p>
<p>This should work on GNOME with the metacity window manager, and the standard GNOME workspace switcher.  It should be easy to adapt to other window managers and workspace tools.</p>
<p>First, install some tools.  On Ubuntu you need:</p>
<div class="code">sudo apt-get install bc wmctrl coreutils grep bash</div>
<p>Now create a file with <tt>gedit ~/bin/workspace-switcher &#038;</tt> and edit it to look like this:</p>
<pre>#!/bin/bash

CMD="$1"

NUM_WORKSPACES=`gconftool-2 --get /apps/metacity/general/num_workspaces`
NUM_COLS=`gconftool-2 --get /apps/panel/applets/workspace_switcher_screen0/prefs/num_rows`

NUM_ROWS=`echo "$NUM_WORKSPACES / $NUM_COLS" | bc`

CURRENT_WS=`wmctrl -d | grep \* | cut -d " " -f 1`

MOVE_LEFT="- $NUM_ROWS"
MOVE_RIGHT="+ $NUM_ROWS"
MOVE_UP="-1"
MOVE_DOWN="+1"

case $CMD in

"Left" )
	NEW_WS=`echo $CURRENT_WS "-" $NUM_ROWS | bc`
	if [[ $NEW_WS -lt 0 ]]; then NEW_WS=$CURRENT_WS; fi
	;;

"Right" )
	NEW_WS=`echo $CURRENT_WS "+" $NUM_ROWS | bc`
	if [[ $NEW_WS -ge $NUM_WORKSPACES ]]; then NEW_WS=$CURRENT_WS; fi
	;;

"Up" )
	WS_COL=`echo $CURRENT_WS "%" $NUM_ROWS | bc`
	if [[ $WS_COL -eq 0 ]]; then
	{
		NEW_WS=$CURRENT_WS
	}
	else
	{
		NEW_WS=`echo $CURRENT_WS "- 1" | bc`
	}; fi
	;;

"Down" )
	NEW_WS=`echo $CURRENT_WS "+ 1" | bc`
	NEW_WS_COL=`echo $NEW_WS "%" $NUM_ROWS | bc`
	if [[ $NEW_WS_COL -eq 0 ]]; then NEW_WS=$CURRENT_WS; fi
	;;

* )
	NEW_WS=$CMD

esac

wmctrl -s $NEW_WS</pre>
<p>Make it executable with <tt>chmod +x ~/bin/workspace-switcher</tt> and make sure ~/bin is in your PATH.</p>
<p>You can run it like this:</p>
<div class="code">switch-workspace Left</div>
<p>to move left &#8211; the other possiblities are, obviously, Right, Up and Down.</p>
<p>Or like this:</p>
<div class="code">switch-workspace 3</div>
<p>to move to a workspace by number.</p>
<p>If you want to use it with easystroke, create an action, and for the command simply enter <tt>switch-workspace Left</tt> and similar as the command.</p>
<p>Easystroke can be installed on Ubuntu like this:</p>
<div class="code">sudo apt-get install easystroke</div>
]]></content:encoded>
			<wfw:commentRss>http://www.artificialworlds.net/blog/2011/03/04/switching-workspace-in-gnome-via-the-command-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Random background in GNOME</title>
		<link>http://www.artificialworlds.net/blog/2009/07/31/random-background-in-gnome/</link>
		<comments>http://www.artificialworlds.net/blog/2009/07/31/random-background-in-gnome/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 08:50:24 +0000</pubDate>
		<dc:creator>Andy Balaam</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.artificialworlds.net/blog/?p=188</guid>
		<description><![CDATA[I&#8217;ve written a little script to show a different random background in GNOME every day, by looking inside your Photos directory. It will rotate them to be the right way up, if you have exiftran installed. Get it here: Random Background.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a little script to show a different random background in GNOME every day, by looking inside your Photos directory.</p>
<p>It will rotate them to be the right way up, if you have exiftran installed.</p>
<p>Get it here: <a href="http://www.artificialworlds.net/wiki/Main/RandomBackground">Random Background</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.artificialworlds.net/blog/2009/07/31/random-background-in-gnome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing the vertical panel window list on Ubuntu Hardy</title>
		<link>http://www.artificialworlds.net/blog/2008/12/10/fixing-the-vertical-panel-window-list-on-ubuntu-hardy/</link>
		<comments>http://www.artificialworlds.net/blog/2008/12/10/fixing-the-vertical-panel-window-list-on-ubuntu-hardy/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 22:20:49 +0000</pubDate>
		<dc:creator>Andy Balaam</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.artificialworlds.net/blog/?p=112</guid>
		<description><![CDATA[For a long time now I&#8217;ve been bugged by GNOME Bug 86382. Recent versions of GNOME have featured a window list applet which behaves badly when situated on a vertical panel (which is where I like to have mine). Older versions were ok except the buttons would expand and contract to make enough vertical space [...]]]></description>
			<content:encoded><![CDATA[<p>For a long time now I&#8217;ve been bugged by <a href="http://bugzilla.gnome.org/show_bug.cgi?id=86382">GNOME Bug 86382</a>.</p>
<p>Recent versions of GNOME have featured a window list applet which behaves badly when situated on a vertical panel (which is where I like to have mine).  Older versions were ok except the buttons would expand and contract to make enough vertical space to hold the window title if written vertically, even though the window titles were written horizontally.  Recent versions have much worse behaviour where once you get over about 7 windows open the window list will flicker rapidly between displaying in 1 or two columns making it almost impossible to click on the button you want.</p>
<p>There have been various patches attached to the bug, and today I managed to get the latest installed on my Ubuntu Hardy 8.04 machine by building custom .debs for the relevant components.  I&#8217;m posting exactly what I did here in case it&#8217;s useful to anyone who wants to get this patch installed, and also as a general reference for what you need to do to apply a patch and install it using Ubuntu&#8217;s (or Debian&#8217;s) package management system as a well-behaved package.</p>
<p>The patches are to libwnck and gnome-panel, and they implement the behaviour I want, which is horizontal text, and buttons of fixed height in a window list which expands as needed to fill the available space.  With this patch installed, I find a vertical panel is the best way to manage a large number of open windows.</p>
<p>I don&#8217;t recommend running this script &#8211; better to read and understand it yourself.  Nevertheless (and with no guarantees whatsoever) if you do run it as is on a Hardy machine, it should install patched versions of libwnck and gnome-panel which work better with vertical panels.</p>
<pre>
# Get all the libraries and source code we need
sudo apt-get install build-essential fakeroot dpkg-dev
sudo apt-get build-dep libwnck gnome-panel

# Create a directory to do all our messing about in
mkdir build-libwnck
cd build-libwnck/

# Get the source code for the 2 components we are building
apt-get source libwnck
apt-get source gnome-panel

# Do libwnck first
cd libwnck-2.22.3

# Create a changelog entry
cat &lt;&lt;END &gt; new-entry.txt
libwnck (2.22.3-0ubuntu2) hardy-proposed; urgency=low

  * applied libwnck vertical window list fix from Alexey Rusakov and Vincent Untz

 -- Anon &lt;anon@example.com&gt;  Wed, 10 Dec 2008 20:50:00 +0000

END

cat new-entry.txt debian/changelog &gt; debian/changelog-new
rm debian/changelog
mv debian/changelog-new debian/changelog
rm new-entry.txt

# Get the libwnck patch and apply it
wget -O libwnck-fix-vertical.patch "http://bugzilla.gnome.org/attachment.cgi?id=124112"
patch -p2 &lt; libwnck-fix-vertical.patch

# Build the package
aclocal
automake
dpkg-buildpackage -rfakeroot -b

# Install the libwnck packages
cd ..
sudo dpkg -i libwnck*.deb

# Now do gnome-panel
cd gnome-panel-2.22.2

# Create a changelog entry
cat &lt;&lt;END &gt; new-entry.txt
gnome-panel (1:2.22.2-0ubuntu1.2) hardy-proposed; urgency=low

 * applied libwnck vertical window list fix from Alexey Rusakov and Vincent Untz

 -- Anon &lt;anon@example.com&gt; Wed, 10 Dec 2008 20:50:00 +0000

END

cat new-entry.txt debian/changelog &gt; debian/changelog-new
rm debian/changelog
mv debian/changelog-new debian/changelog
rm new-entry.txt

# Get the gnome-panel patch and apply it
wget -O gnome-panel-fix-vertical.patch "http://bugzilla.gnome.org/attachment.cgi?id=107133"
patch -p2 &lt; gnome-panel-fix-vertical.patch

# Build the package
aclocal
automake
dpkg-buildpackage -rfakeroot -b

# Install the gnome-panel packages
cd ..
sudo dpkg -i *panel*.deb
</pre>
<p><b>Update: fixed incorrect comment &#8211; thanks Stefan.</b></p>
<p><b>Update: changed -p0 to -p2 in the patch commands.</b></p>
]]></content:encoded>
			<wfw:commentRss>http://www.artificialworlds.net/blog/2008/12/10/fixing-the-vertical-panel-window-list-on-ubuntu-hardy/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>

