Ubuntu window list

2011-07-22 00:57:00

Another four hours of my life I won't get back. Hopefully I can spare you at least some of it. Or, worst case, deliver you a solution after going through the same pain.

Case in point. I deactivated the Unity UI because it basically sucks, is unnecessarily heavy and ... oh right, it sucks. Note that I did not know the "classic" Ubuntu UI. I now do know I prefer it. Anyways...

Ubuntu has these panels. The panels have some kind of applets. One of these applets is the "open window list". This thing is what you'd want. Something I was really missing in Unity (I know that interface basically shows you the same thing, but I don't like it and I also don't like grouping my open windows).

Now, the second thing I like is to put my menus vertically. Seriously, you have so much space horizontally. Why would you waste vertical space by putting menus on top and bottom of it? No more. I put them vertically. On the left, actually. This works fine in Windows but Ubuntu has some quirks. Most of them are... well, acceptable for the time being. One of them is not. Or actually two, but turns out they were caused by the same bug.

The problem is that the window list in vertical mode has some graphical glitches. I was able to live with most of them (variating button height, for example) but there were two problems that were "cramping my style". One was that the height for program item elements was for some reason set to some static height, way less than my window height. The other one, slightly more problematic, was that if you'd open more than eight windows, the applet would want to create another column. This would cause a continuous reflow, back and forward, and use 50% ~ 100% of cpu time. For no damn good reason. Oh and the list would become useless too. So yeah.

So the root of the problem turns out to be that the applet doesn't check for orientation at the start of the app. Btw that's not found by me, I'm just saying what other people mentioned in this bug thread. By the way, FIVE YEARS OLD. Anyways, at this time near the end of the thread (39) the answer is given. And three posts later (42), an answer I could eventually get working. Here's how it goes...

You will need to be either root or have access to sudo. I suppose sudo is preferable (I prefixed all commands with sudo for this reason), but I don't really care what you use. You don't need the sudo prefix if your current username is root.

Open a terminal (ctrl+alt+t) first. Now we move to a tmp dir. We'll create a tiny mess in there, be warned.

Code:
mkdir ~/.crap
cd ~/.crap

Get the source code for the gnome panel, and some dependencies. Determine whether you want to install all those packages, but if you want to fix this the answer is yes.. :)

Code:
sudo apt-get source gnome-panel
sudo apt-get build-dep gnome-panel

Now your .crap folder will have a bunch of stuff, amongst that a new dir. It'll be gnome-panel-xxx, where xxx is a version number that will differ. For example, mine currently says gnome-panel-2.32.1. Move to it.

Code:
sudo cd gnome-panel-xxx

Now the actual bug fixing. We need to add a single line to one of the source files. Yes, it's that simple. First open the file with a simple editor. If you don't have nano you can use pico, joe or whatever. It will probably exist though.

Code:
sudo nano applets/wncklet/window-list.c

Now add the following line at the start of the function tasklist_update, somewhere around line 70.

Code:
wnck_tasklist_set_orientation(tasklist->tasklist, tasklist->orientation);

The next reply in the bug list will complain it won't work, but the reply after that will say it works fine. And it worked fine for me too. Now we save the file by pressing ctrl+o (if you're not in nano or pico, saving might work differently) and exit the editor by pressing ctrl+x.

Now we are going to actually build the source code for your system. Simple step but will take a few minutes.

Code:
sudo dpkg-buildpackage

Fingers crossed, because if this step fails I can't help you either (unless you're not root, in that case make sure you are before trying again). Note that this will only build stuff, so if it does break, your system is completely safe (!). Nothing on your system is updated in this step. The software is simply created, or at least attempted to be created.

Anyways, if it all goes well, you'll end up with a bunch of binaries you can use on your system. Hurray. You can find them in the upper directory. So go there..

Code:
cd ..
ls

See the mess? You'll see a bunch of gnome-panel* files, as well as some libpanel* files and some other files. Ugh. Out of these files, all we need is the gnome-panel_xxx....deb file. Note that it ends with .deb, but there might be some garble between the version number and the end. For example, my build result was gnome-panel_2.32.1-0ubuntu6.5_amd64.deb (I'm on 64bit). On the forum he mentions "gnome-panel_xxx-1ubuntu3_i386.deb". So take the right file.

We'll now install it on your system:

Code:
sudo dpkg --install gnome-panel_xxx....deb

And all there's left now is to knife the running instance and replace it with your new version! By simply killing the running instance, Ubuntu will ask you whether you want to respawn them. Just agree to the popups...

Code:
killall wnck-applet

And there. At this point, I can add many new open windows and stuff won't break. Hurray for science!

We can remove the temp dir, if you want to. I would at least keep the package to install it again because whenever I update something in the core or even sometimes when I reboot, I have to restore this version again, which only requires the last two steps.

Code:
cd ..
rm -rf .crap


Note that if the build process b0rked anywhere and you want to retry, you might have to remove everything and start from scratch. I know I had to at least three or four times before getting it right... Some files get corrupted or changed beyond repair. Very nice how that works.

Afterwards you might want to ignore updates to this package, as the update manager will keep on bugging you..
Code:
sudo echo gnome-panel hold | sudo dpkg --set-selections


Hope it helped you. It sure cost me enough time :/