Gnome3 (gnome-shell) is very slow using latest ATI Catalyst Drivers

Well, the 12.1 upgrade (Jan 25) at least made Gnome3 usable… The tearing and bad rendering seen with fglrx have finally gone but everything is painfully slooooooooooow.

Two things helped me get an almost responsive desktop, and I don’t know which one actually did the trick. They should actually do the same thing, but who knows?

The first thing I did is to go to the Catalyst Control Center and disable both Vsync (under 3D section) and Tear-Free (under Monitors) options. That seemed to give a little boost to the overall responsiveness of my desktop, but another thing I found out from a comment to a bug report on ATI’s bugzilla is to add this little magic line to your /etc/environment file:

export CLUTTER_VBLANK=none

This should be the equivalent for disabling the Vsync option from the Catalyst Control Center, I guess, but after rebooting everything seems to run a lot more smoothly!

Eclipse crashes on startup with Gnome3 on Ubuntu 11.10

Speaking of Gnome3 choices, I really like the whole CSS-ish management of themes: I’m sure it’ll help in making the gnome-look community grow with a number of experienced web developers who won’t have to struggle too much to deliver great-looking themes.

Once again, I think that at this moment we’re not quite there yet.

Not liking the fat-ass default title bar that Gnome3 comes with, I switched to the sleeker Adwaita Dark theme (the link to the developer’s website doesn’t seem to talk about it?) and I’m fine with it.

On an apparently completely unrelated front, Eclipse started to crash on startup, with no error messages logged on workspace/.metadata/.log, no errors on ~.xsession-errors, no errors on the shell! The splash screen would show up, no progress bar would ever come up, and it’d stay forever like that (sometimes with a java process taking up to 100% of CPU, sometimes not).

Out of plain desperation, I went for a shy export GDK_NATIVE_WINDOWS=1 on the shell script that I use to launch Eclipse and… guess what? It worked! ๐Ÿ˜€

I use an external script to choose one of the installs of Eclipse I have (Helios J2EE, Helios CDT, Indigo.. so I have /usr/bin/helios, /usr/bin/cdt and /usr/bin/indigo), but for what concerns this issue it may come down to this:

#!/bin/bash
export GDK_NATIVE_WINDOWS=1
./eclipse

But then I thought… surely the theme I just installed has nothing to do with this issue, right? Well, I was sadly wrong. Using Gnome Tweak Tool (I don’t understand why this does not come with Gnome by default) I figured out that switching the GTK Theme back to default (Adwaita, but not dark) Eclipse runs fine without the GDK_NATIVE_WINDOWS variable set! And I can keep the Adwaita Dark windows decoration theme!

Another step towards XFCE I managed not to take.. Gnome3, don’t fail me, I’m trying hard to like you! ๐Ÿ™‚

Add a simple restart Gnome Shell script to your right-click menu

After using the behated Unity for too much time I decided to give Gnome3.2 another chance; last time I tried I couldn’t get my cheap integrated Radeon 3000 graphic card to work with all the rendering gnome-shell requires, so I had to pick one of Gnome “classic” or Unity2D. The latter is a little less ugly, albeit suffering from too much rigidity in what you can customize and what you cannot. I tried to like it, I really did, but working with the left dash bar is painful to me.

So, after installing the latest catalyst drivers (12.1) from ATI I’ve been able to use Gnome3, and after tweaking it hard with several extensions (nice system, by the way, but maybe support for browsers other than firefox would help) I now have a desktop that I kinda like. It’s sad that I used to like Gnome2 better, though.

Not speaking of its slow responsiveness (I admit my GPU is no monster, but my PC is 10 months old, so I’d expect it to run whatever window manager… heck, it runs KDE 4 just fine!), what I find astonishing is its instability. Every now and again, gnome-shell screws up for whatever reason, and all window controls are gone, top bar and the gnome-shell itself as well. Switching to another tty with Ctrl+Alt+F1 and logging in with my user to killall gnome-shell is not helping since the gnome-shell process lies in the other session that I’m therefore forced to kill, restarting the gdm process.

At first I used this little hack from phreaknerd’s blog: you schedule a script for automatic execution that checks whether a “delete me if you want to restart gnome-shell” file exists every 15 seconds (so the routine was like: gnome-shell dies, switch to tty1, login, rm polled file, logout, Ctrl+Alt+F7 back to graphic session, wait for the script to find out).

But then I grew tired of waiting the 7.5 seconds (on average :P) for the script to detect that the control file is missing, and of the whole tty switching in general; since I’m always able to right-click on the desktop (if anything on the empty space left by the gone window decorations) I think a better solution is to add a simple script to ~/.gnome2/nautilus-scripts/ (why is it still called gnome2 anyway) like this:

cd ~/.gnome2/nautilus-scripts/; echo -e '#!/bin/bash'"\n"'gnome-shell --replace' > Restart\ gnome-shell; chmod a+x Restart\ gnome-shell

So now all I have to do is right click somewhere on the desktop, choose Scripts/Restart gnome-shell and I can get back to work! ๐Ÿ˜€

I really, really, really hope that 3.4 will be a lot more stable though…

Retrieve the window object from widgets with pygobject / GTK+3

I’m trying to develop a simple app using PyGObject, pyGTK as we used to call it last time I used it.

I must say that I mildly hate Gnome 3 (and Unity, for that matters) and even though there’s certainly been an improvement in the overall quality of the API for GTK+3 the lack of documentation and good tutorials is very depressing. One must always fall back to C documentation and hope that a python function exists with a similar name, or struggle through the source code to look for it.

Rant aside, one thing I wanted to do is to draw on a DrawingArea using Cairo whenever the mouse cursor enters some region. Once I got Glade to signal the motion-notify-event correctly (you have to both set the signal on the ‘signals’ tab and check the option for ‘Pointer Motion’ in the ‘Common’ tab under ‘Events’) I realized that you must create a Cairo context every time the signal handler is called, so that you can draw on it.

Googling and googling (and after stumbling upon the best source for what I wanted to do… even though it’s in Japanese! :D) I found that the easiest solution is to call something like

def onMouseMove(self, widget, event):
  cr = widget.window.cairo_create()
  cr.arc(whatever...)

Unfortunately, an AttributeError: 'DrawingArea' object has no attribute 'window' came up, so after more googling I found out that the new fashion is to call get_property("propertyName") to retrieve its fields… which is not bad in and on itself (if not a little too weakly-typed for my tastes), but it’s not that immediate if you were used to code for GTK+2.

This is what I finally came up with:

def onMouseMove(self, widget, event):
  cr = widget.get_property('window').cairo_create()
  cr.arc(whatever...)

Now I just have to do the rest… ๐Ÿ™‚

Have JavaHL remember SVN credentials (user/password)

I was forced to move from SVNkit to JavaHL, so I immediately crashed into the poor integration that JavaHL has by default with Eclipse.

I added a new repository, one in which my username is different from the one I use for my laptop, and even though Eclipse prompted me for the password I had no way to change the username. I tried to remove the conf folder from the .subversion one I have in my user’s home, but to no avail. I also wiped the .subversion directory altogether, but still it wanted me to use my local machine’s username.

Googled around, found no solution.

So, what I ended up doing is putting the full repository URL (complete with my username on the remote machine, as in svn+ssh://username@repository/path/to/repo) and exporting my SSH public key to the server. Yes, JavaHL asks you to type your password every. damn. time.

If you never generated your public key, just type ssh-keygen -t rsa in a shell and choose all the default options, they’re fine.

Then, export your key to the repository (one of the most frequent sequence of commands I’m using these days):

cat ~/.ssh/id_rsa.pub | ssh myUser@repository 'mkdir -p .ssh/; cat >> .ssh/authorized_keys'

Of course, replace myUser@repository with your username on the remote repository in the previous command, and you’re good to go ๐Ÿ™‚

Fix “JavaHL (not available)” problem with Subclipse 1.8 in Ubuntu

Since good ol’ SVNkit is no longer an option when choosing the client with which subversion operations are to be done within Eclipse, we’re left with native library dependent JavaHL. Not being the awesome pure-Java library that SVNkit is, all sorts of dependency resolution issues arise, and most probably you’ll get a “JavaHL (not available)” entry when choosing the client in Eclipse under Window/Preferences/Team/SVN.

I had to struggle a little bit on this one. If I were you I’d just download an older version of Subclipse and switch to SVNkit, but if you want to stick with the “official” client, here’s how I fixed the issue.

First of all, exit Eclipse. Then, download the right packages from here (“right” meaning “the ones for you own distribution”. Mine is currently Oneiric, so in the examples I’ll use that). You’ll need libsvn1 and libsvn-java. You can get those also with apt-get, but you’re not getting version 1.7, which is what you need for Subclipse 1.8; if you want to use a previous version and you really like JavaHL, go for it.

Once you’ve downloaded the two packages, you may have to install libserf1 as well (that I installed using apt-get, but you can also find it where the other two packages are). I also chose to install subversion_1.7.2, but I think that the repository version works anyway, so you may not have to.

So, I’m using Ubuntu Oneiric 64 bit, here’s what I did:

sudo apt-get install libserf1
wget https://launchpad.net/~dominik-stadler/+archive/subversion-1.7/+files/libsvn1_1.7.2-0ubuntu0%7Eppa1oneiric1_amd64.deb
wget https://launchpad.net/~dominik-stadler/+archive/subversion-1.7/+files/libsvn-java_1.7.2-0ubuntu0%7Eppa1oneiric1_amd64.deb
wget https://launchpad.net/~dominik-stadler/+archive/subversion-1.7/+files/subversion_1.7.2-0ubuntu0%7Eppa1oneiric1_amd64.deb
sudo dpkg -i *.deb

You’re not done yet!

Open the eclipse.ini file inside your Eclipse home folder, and add this line at the very bottom (it should be listed among the vmargs, that are one per line)

-Djava.library.path=/usr/lib/jni

Then, restart Eclipse and you’re done!