Quick and dirty jQuery centred tabs

It appears that there isn’t a way to centre the tabs for jQuery.UI, unless you’re prepared to resort to quick and dirty hacks like this one I just cobbled together:

window.onresize = function()
    var pad = (document.width - 700) / 2;
    $('#tabstrip').css('padding-left', pad + 'px');

You’ll have to give an ID to the first bulleted list at the top of your tabs (the one that makes up the “tabs” themselves); I’ve called mine “tabstrip”. What makes this hack even more dirty than quick is that I’ve hard-coded a value that represents the width of all my tabs. I tried all sorts of things to calculate it on-the-fly but that proved unreliable, so I’m going with what will work best in most situations for the internal-use scenario I have in mind. You might also want to put this code into a separate function and call it from $(document).ready() so that it appears in the right spot when the page loads, too.

Hopefully one of you CSS geniuses out there will tackle this and add the ability to centre the tabs for lazy folks like me. Or even center it if you’re American :-) I’m easy either way.

I’m with Linus: KDE 4 sucks!

A week ago I posted an entry saying that I might use Linux, but I wouldn’t recommend it. A comment to that post by one “JD” said that this was because I have “made bad Linux choices”. Well, having decided to bite the bullet and give Ubuntu with GNOME a try, I’m inclined to agree. KDE might have kept a control-freak like me reasonably happy until now, but compared with Ubuntu’s GNOME, the 4.x variety is just rubbish! Even Linus himself thinks so.

About six weeks ago I switched from Mandriva 2009.0 to openSUSE 11.1, but the problems gradually mounted. Here’s a summary:

  • The hard disk would grind away like a ticking clock when downloading files or streaming video, and would sometimes even lock Firefox or another application until the disk operation had finished. I did try fiddling with swappiness and the I/O scheduler, but none of these made a difference in openSUSE. I hardly ever hear the disk in Ubuntu
  • I couldn’t play audio CDs
  • KDE 4.1.3 would occasionally just die with desktop icons disappearing then all my applications failing to respond; couldn’t even switch to a full terminal to log in
  • Dismounting removable media in Dolphin doesn’t show logical feedback of the change
  • YaST2, even though I said it was better than drakconf, eventually became irritating with its constant refreshing on startup
  • Special effects in KDE 4.x are lame compared to Compiz and aren’t as fast, either
  • The Kicker eventually annoyed me. Yes, I could have switched to the old style, but it just added to the feeling one gets when a product “just feels crap” all over
  • Audacious is available by default in Ubuntu’s repositories and I didn’t have to use a third-party Packman repo to get it
  • Power management for my Dell 2407WFP-HC monitor actually works in Ubuntu. In openSUSE I had to keep switching it off and on all the time if I didn’t want to waste power. After six weeks of this the button doesn’t work anymore and I’ve had to arrange an exchange with Dell
  • After installing VirtualBox in Ubuntu, I didn’t have to reboot for it to work. Not that this is major but I had to reboot in openSUSE for some reason
  • Auto-completion of emails in Kontact didn’t work. Now that I’ve switched to Thunderbird, things are better
  • K3b couldn’t eject burnt DVDs half the time

A problem that I’ve had for some time was the clipboard breaking whenever I ran VirtualBox but I eventually discovered that updating the guest additions to the current version fixed it (no more “ŸŸ” pasting only, yay!) so I can’t blame either Mandriva or openSUSE for that, but I think VirtualBox should detect old tools and notify the user.

So, I now have none of the above problems in Ubuntu 8.10 (I went with the 64-bit version, and so far, no hassles, apart from having to add a -vm switch to my Eclipse icon telling it which Java version to use for Aptana). That’s not to say that there aren’t some things I’d prefer were different in GNOME, so here goes:


  • Can’t drag/drop files onto buttons in the pathbar (have to open a tab first then drag to that tab)
  • I wish there was a List View size between 33% and 50%
  • No rubber-band file selection in List View (this has prevented me from using a GNOME-based distro for ages, but since everything else works so flawlessly in Ubuntu, this is a sacrifice worth making)
  • Pause/resume for file copy operations (and a bit more information) would be nice
  • Needs a way to hide some places in the left column (like partitions I haven’t bothered to format yet)
  • Beeps when deleting files – very annoying! (have to turn off default beep completely!)
  • Doesn’t show current directory size down the bottom


  • It would be nice to be able to see if a package was 32 or 64-bit in Synaptic
  • Ctrl+Tab instead of Ctrl+Alt+Page_Up/Down would be better in gedit
  • You can’t drag/drop files out of File Roller into Nautilus (or anywhere else)
  • Transmission is too basic, even by GNOME standards, and needs a pause/resume all menu item in the tray icon. Just an observation, since I’ve gone with Deluge anyway

Having got those off my chest, I’ve reached the point with KDE 4.x that even these GNOME annoyances are now minor in my view, and I’m prepared to live with them to get an operating system as near perfect as Ubuntu. Even the fonts seem to look better than in openSUSE or Mandriva, which always irked me in KDE. Maybe it was the distro’s choice of fonts, I don’t know; all I care about is the fact that there can be no question in my mind now that Ubuntu is the most popular Linux distribution for a reason: it just oozes quality! KDE and their distributions are going to have to do a damned fine job before they’ll entice me back now.