More KDE 4
Recap
It's been several days since I installed KDE 4.
I've been using it off and on, experimenting with Arora and Dolphin. I'm just starting to sample the applications available for Qt/KDE.
Blokkal: an extendable blogging client for KDE4
One thing I did discover earlier tonight was a blogging client called Blokkal. This client caught my eye because it supports the LiveJournal protocol, which makes it one of about three (?) actively developed LJ clients on the internet. The others were all discontinued years ago, and their ebuilds have been removed from Portage. Sure, the source code is still available, but it's tough to integrate features such as tags, userpic management, and various other LJ service improvements. Or they come with heavy Gnome dependencies, as in the case of BloGTK and Drivel. (Yeah, I still think in terms of "how much will this weight down my Xfce desktop.)
So finding out that there's a native client that supports LJ was quite a treat. Blokkal also supports many other blog APIs, but I don't use 'em, so the only draw is the LJ integration.
Writing the ebuild
My next step was to write an ebuild for Blokkal, since a quick check of the Portage archives didn't turn up any ebuilds. Thus I began my plunge into the source code of the app and reading the stated requirements on the homepage.
Blokkal has a CMake-based build system, and it lists kdelibs, KDE PIM libraries, and the Phonon library as its requirements.
The first step of writing the ebuild was to get the basic header stuff (HOMEPAGE, SRC_URI, etc.) out of the way, then add the raw deps.
Dependencies
I was initially a bit unsure of the PIM library listing, as we have in Portage both kdepimlibs and libkdepim. The first was closer to the Debian package name, so I took a chance that this was the correct one. After that, a few quick eix checks on the rest of the packages sorted out the likely names, and then it was on to the source code to see what was a runtime dep, and what was a buildtime dep.
Turns out that with one exception, DEPEND was the same as RDEPEND, so that saved time. I initially had kdelibs as an explicit DEP, but Jonathan Callen (ABCD on IRC) kindly corrected me, as it's already in kde4-base.eclass. (Thanks to him and wired for answering some of my inquries.)
Eclasses
Eclasses were the next step: which eclass should be used to get proper background dependencies, source configuration, compilation, and installation? The KDE and Qt teams have been very good about eclasses over the years; most ebuilds inheriting them don't need much in the way of actual code lines -- no need to duplicate anything when the eclass does the work for you.
There are a few different KDE4 eclasses available in the tree, and I had to read through 'em all to guess which one was most appropriate. Other KDE applications in Portage don't need many lines of code; the various eclasses do all the heavy lifting. I jumped on IRC to confirm my choice of kde4-base.eclass, then ran the emerge, only to be met by compile failure!
Compiling and running
I suspected it was an error I've run (and fixed) before, and sure enough, it was: I just had to redefine ${S} since the package download is Blokkal-0.2.1, but the ebuild is blokkal-0.2.1 in lowercase. I'd gotten ${MY_P} right elsewhere in the ebuild; just forgot this one thing.
After the fix, it compiled just fine, started up just fine, and I added my account . . . only to discover that I couldn't log in. Something was missing . . . but what?
I took another look at Blokkal's source code. There were a few kwallet headers and kwalletmanager references that implied another runtime dependency was needed. I added kwallet to the ebuild's RDEPs, recompiled, and finally got the popup window asking for the password. Now I could login to my account and do some Blokkal UI configuration.
Try it out
Since the ebuild is finished, why not try out Blokkal? Get the ebuild here.
Coming up
So there you have it: another step in my KDE4 odyssey. I expect to get my hands on some themes, multimedia applications, office/writing tools, and more.
Obligatory screenshots
Here's my current desktop, which mostly shows off the "Naked" plasma theme and my desktop widgets:
For comparison, here's one with a couple of open applications. This shows how well gtk+ applications are integrated into KDE, thanks to the QtCurve style. In the background is Dolphin (Qt4) and in the foreground is Abiword 2.8.1. (From the ebuild I wrote for it)
On KDE 4.3.3
I finally did it: I compiled and installed KDE4 on my laptop on the 5th. Took all night. Hours and hours, but it was ready the next morning, with nary a compile failure. Which is good, since it is the stable branch and all. But wait . . . KDE?
Why KDE?
In a word, SLiM. Sometime in mid-December I caught an X11 update that made SLiM stop working. Or maybe it was something else. My theory is it was the xinit update that dropped twm, xclock, and xterm from the required runtime deps. So abruptly SLiM stopped working, and I couldn't login graphically; I just got errors saying "Couldn't execute login command" with nothing else in my logs. Forums didn't help. I could run startx manually, but that's a pain. Not suitable for a laptop shared with my wife. I unmerged SLiM and started looking around for alternatives. GDM is one, but it drags in a bunch of Gnome dependencies. XDM is just ugly and unconfigurable, and lacks the appropriate shutdown/restart/suspend actions. KDM was the last candidate. Yes, it had lots of KDE dependencies, but I figured that if I installed KDE4, then it wouldn't have as many deps, right?
Yeah, I know, it's like: "But . . . aren't you an Xfce guy? Don't you exclusively use gtk+ environments (including Gnome in years past)? Don't you hate heavyweight crap or endless C++ compiling?"
Yes, yes, yes, and yes. I know. But here's the thing: after initially getting excited about Aaron Seigo's (now canceled) upcoming talk on KDE at SCALE, I then found out that Camp KDE will be right here in San Diego, just a few miles from where I live. So I started thinking -- now that things have settled down since the disastrous 4.0/4.1/4.2 days, maybe . . . maybe it would be worth experiencing directly what "the future" is all about, according to the hype machine. I'm thinking of visiting Camp KDE, so I thought if I do, I should have some knowledge of how KDE currently works.
Past and present
The last time I ran KDE was back in late 2004 or early 2005. As far as I remember, it wasn't even on Gentoo, but on other LiveCDs and distributions. I still have an old Knoppix CD from 5 or 6 years ago lying around -- and that was KDE3-based. Given Plasma and all the other new buzzwords and technologies and new paradigms, I figured it was about time to see how things have progressed.
Or stayed put.
Configuration
True to form, KDE4 still makes configuration this massively complex, insanely arcane art. You need an engineering degree to wade through the simplest of configuration menus, even when right-clicking on an item in your panel -- if you can find it, that is. The dialogs are very inscrutable; it makes navigation difficult. All these weird arrows and spaces and popup panels in the default theme, not even something with extra bling.
One of the first things I did was turn off that stupid window-that-is-not-a-window on the desktop, so that I wasn't distracted by all the flashy Plasma widgets. After that, I spent a half hour trying to tweak the font settings. I discovered that buried in the Antialiasing dialog are the actual hinting and RGB subpixel hinting configs that I was looking for, though there's a catch. You can actually disable (that is gray out) the AA option, which makes you unable to get to the stuff below it. BUT, as long as you've tweaked your hinting settings before exiting that subdialog, that's okay! You just have to re-enable AA to get into the hinting subdialog. Stupid, I know. The Xfce way is much, much better; all three options are exposed top-level.
After making my desktop readable with Verdana fonts, it was time to start poking around. And around and around and around -- it's easier to navigate the Windows Control Center than KDE CC. Things haven't changed there in 6 years. It's especially bad when you get to the properties of your Qt theme, in this case, QtCurve. Several dozen confounding lines popped up in the right box, dizzying amounts of tweaks that should in no way be exposed to the end user. Seriously, just let the theme author set 'em and forget about 'em. If there need to be variants...don't expose every last line of optional code to the user.
Integrating gtk+ apps
Despite some initial setbacks, I decided it was time to start installing a few more packages. See, I wanted a bare minimum install, which turned out to be 74 packages for kdebase-startkde and kdm. That's after tweaking my USE flags for half an hour to whittle the dependencies down. Yeah, that's the bare minimum -- I was at only about 470, 480 total packages for my very minimal Xfce environment. I like my laptops to run lean.
Then I added qtcurve-qt4, gtk-engines-qt, and kcm_gtk, since without the unfortunately ~arch kcm_gtk, it's not possible to have your gtk+ apps use your Qt theme. This needs to be rectified; the gtk+ module should be stabilized ASAP, given that everything else is stable. Once in place though, even Firefox behaved nicely with my Qt theme. Very nice.
After fleeing from the QtCurve controls, installing kcm_gtk, and restarting KDE, I was able to get my gtk+ apps integrated nicely with KDE. That's one area that KDE4 beats Xfce and Gnome, at least in Gentoo. We don't have a "Make your Qt apps look like native gtk apps" gtk+ engine in Portage.
Packages: webbrowser
I still needed a file manager and a webbrowser, so I decided to install Konqueror, having used it in years past. It turns out that Konqueror doesn't have dual-functionality anymore; it's just a webbrowser. A webbrowser that can't use Flash until you install kde-base/nsplugins, FYI.
Konqueror startup is much better than it was 5 years ago. It's still kinda slow, but not as slow as Firefox! The downside is that when running, it tends to be a bit slower since it doesn't have the nice Adblock features that the Firefox extension offers. Yes, it can kind of do Adblock with lists, but as far as I could tell, it was still downloading all the "blocked" content and rendering it, but just making it invisible via CSS or some such mojo. It's still doing all the processing of heavy Flash and Javascript, but where you can't see it. Contrast that with never downloading blocked content in the first place.
Speaking of Adblock, I think the main reason why I'm still on Firefox is that there's not a single Adblock implementation that has the functionality of the Firefox version: making it easy to right click on anything, Flash, iframe, image, text, etc, and add it to the blacklist with a simple click. Nothing else even comes close, and I've tried almost all the gtk+ webkit browsers out there. None of them can do it. Which is too bad; I love webkit's speed and rendering accuracy, but no browser that uses it has integrated an easy-to-use constantly-configurable Adblock plugin. Maybe Arora, Rekonq, or some other Qt browser can, but I'm not holding my breath.
Packages: file manager
So I'm still on the lookout for a good Qt webbrowser, and a file manager while I'm at it. Supposedly Dolphin is the new Konqueror, but the jury is still out on its dependencies because of weird USE blocks. I've been sticking with Thunar, which now looks good in QtCurve, except for the icons. I get a lot of default blank icons even with the help of kcm_gtk. For some reason, despite activating the right setting, the KDE icon theme isn't fully integrated with Thunar. I'll give Dolphin another shot tomorrow.
Packages: terminal
Konsole works decently -- it doesn't start up as quickly as Xfce Terminal, but it does blend nicely with KDE (of course). Its configuration works just like the ol' Gnome terminal: instead of the simple, obvious "Edit Preferences" menu found in Xfce Terminal, you have to click "Edit current profile." Which means you have to know what a profile is, that you're using one, and that it has things you want to change in it. Still, Konsole is fairly configurable; I got it to my preferred white-on-black setup, with my fonts just how I like 'em. It did what I wanted it to after a bit, though I didn't find the option to disable "Scroll on output," which is annoying when I want to read a bit of emerge output in mid-compile. Minor nitpick; I'm otherwise satisfied.
Speed and desktop effects
Performance is another matter. Yes, I am running a mostly stable/some ~arch Intel graphics stack, on an X3100 IGP, but come on . . . I expect window moving, resizing, fading, and switching to be snappier! Once I enabled desktop compositing, it both helped and hindered window usage. The OpenGL renderer is faster than Xrender. Xrender is much slower at window fading and moving; there's lots of lag. However, the OpenGL renderer leads to buggy themes -- about half the Qt and Kwin themes are unusable because of serious visual glitches and artifacts that corrupt the widgets and buttons. This is present to some degree even in the default Oxygen/Ozone themes, and to a lesser extent in QtCurve. Sometimes widgets flash real fast or in weird colors when you mouse over 'em, sometimes they remain normal. It might just be Intel graphics code; who knows. It doesn't happen when using Xfwm4's Xrender compositing, though. Xfwm4's compositing is also very snappy, with no slowdown.
While there are some performance issues, and some OpenGL problems, I did discover something totally neat, something even my wife thinks is cute and wants on her Mac: the snow widget! KDE4 includes an awesome composite trick that brings weather onto your desktop. You can set it up so that there's gently-falling snowflakes behind all your windows. Awesome! So peaceful and cozy. If I take away one thing that gave me a good feeling from the experience, it was enabling the snow candy -- which isn't as hard to do as it was in Compiz, I might add. Mmm, snow.
What I really want now is some "rain" eyecandy that does the same thing. Or better yet, some kind of Plasma widget that sends rain/snow/wind/sunshine/etc. across my desktop depending on what the actual weather is in my area. Anyone heard of something like that? It'd probably have to tie in to accuweather.com or something. Man, that'd be sweet!
Panel widgets
Speaking of desktop widgets, while I haven't even scratched the surface of what Plasma can do, nor of all the thousands of Plasmoids out there, one widget that really bugs me is the clock in the panel. Seriously. What is up with this useless clock? Its only config options are "fonts," "timezone," and "timezone." Oh yes, and "timezone." Is there enough timezone yet? Apparently not. I can't even make it 12-hour, nor display the month/day in the format that I'd like. Even Xfce's not very-click-userfriendly clock at least gives me full display control by offering the time shell codes. Once I learned how they work, I set it up to my liking: %a, %b %d %l:%M%p, which results in Wed, Jan 06 11:47PM. I can't do that in KDE.
Heck, the menu that I get from clicking on the clock widget is not the same menu I get when going to the KDE CC and clicking the time dialog there. That's another HUGE gripe of mine against KDE over the years: so many different menus in so many different places, for the same option or really similar options. What I really don't like is right-clicking an object to see one menu, but then I see a totally different menu when left-clicking it. Oh man, you've just lost a lot of points in your UI design right there. The other thing in KDE that bothers me is the constant renaming of things. It's not always just "Properties" in the right-click menu, nor is it always easily accessible. Sometimes I have to scroll down to hit a horizontal arrow that exposes the "Properties" dialog or whatever it's called.
I don't think this is because it's an add-on application; this is all the stock KDE you get from emerging kdebase-startkde, not some random app from kde-look.org. Shouldn't there be more of a unified, easily accessible user interface? It feels like the right hand's not talking with the left hand throughout the desktop.
Future
Still, I want to press on and learn the system. I want to get through it and use it long enough to really see if it works for me. There's also the school of thought that says that if I have to adapt myself to the tool in order to use it, then the tool itself is broken from the start. Something to think about.
There's also this whole "semantic desktop" framework that's part of KDE. I have no real idea what it is, how to use it, how many resources it consumes, or even if I want it. But it's something I want to try out . . . somehow.
Assuming that I do stick with KDE's foibles'n'gripes and take the time to get over the learning cliff, deal with all the pesky annoyances, and generally persevere . . . I'll need to install more applications to get a useful workspace. If I'm going to take the time to get a good dual-boot desktop environment going, I need something to make it productive. That means music and video players, spreadsheets, word processors, instant message apps, a mail client. (Oh, the horror of migrating yet again, having lived through the Thunderbird -> Claws move). CD players/rippers/burners. Printer utilities. Easy WiFI/networking controls. Power management tools.
All kinds of apps that I have some idea about, but only from "the other side of the fence," things I've only read about in the gtk+ world. On the other hand . . . as long as my existing gtk+ apps are integrated visually into KDE (thanks to QtCurve) and "just work," maybe I don't need to duplicate my entire Xfce environment?
Still, suggestions and feedback are very much appreciated.
Amazon MP3 Downloader on 64bit Gentoo Linux
Update 2010/12/04: A commenter recommended clamz instead. I’ve installed it but not yet tried it, but it’s certainly easier than installing another OS in a chroot.
(This is going to be a bit of a narrative. If you’re impatient, scroll to the “How-To” section at the bottom of the post.)
Today I decided to download an MP3 album from Amazon. I actually wanted all the songs on the particular album, and noted that you save a couple bucks by downloading the whole album vs. downloading each individual song. So click through, and find that it requires the Amazon Download Manager thingo.
Lame, I think. I click the download link, and it actually gives me some buttons to choose from that have to do with Linux. Huh. Nice work. However, I assume it’s closed-source proprietary crap. But hey, why not give it a try.
My choices are two .deb files, one for Ubuntu Jaunty, and one for Debian 5, or two .rpm files, one for Fedora 11, and one for OpenSuse somethingorother.
So I grab the Ubuntu one. I’m on Gentoo, so I “emerge dpkg”, and then run “dpkg -x amazonmp3.deb .” in an empty directory. I look in usr/bin that it created, and find a binary. But it’s a 32bit binary.
Crap.
I run ‘ldd’ on it, and of course it needs gtk and a bunch of other stuff that I don’t have 32bit libraries for. Like boost.
So I think, ok, I can install a 32bit chroot. So I download the stage3 Gentoo i686 tarball and unpack it in /opt/gentoo32. I also “emerge schroot” in my regular system, and set that up. I recently found schroot while using Ubuntu at work. It’s awesome. Eventually the stage3 tarball finishes up, so I schroot into my new 32bit environment and “emerge libboost”. After it’s finished, I note a problem. Amazon’s binary is expecting some weird version of boost that has “gcc42” in the filename. Also, I just installed boost 1.35, and it wants 1.34. Out of desperation, I try to make symlinks to the correct file names, assuming it probably won’t work. I was right: it doesn’t work. Balls.
Then I think… well, why not install a chroot of 32bit Ubuntu Jaunty? I “emerge debootstrap” and pray… yep, it’s in portage, excellent. I install it, schroot into it, and apt-get a bunch of the libboost packages, and… holy crap, it works.
How-To
Here’s a step-by-step. This is for Gentoo, but it should work equally well on any system where you can install debootstrap and chroot. The following instructions assume you’ve installed them already.
As root on the “main” system:
# mkdir -p /opt/ubuntu-jaunty-32 # debootstrap --arch i386 jaunty /opt/ubuntu-jaunty-32 http://archive.ubuntu.com/ubuntu/ # cat >/etc/schroot/chroot.d/jaunty32.conf [ubuntu-jaunty-32] type=directory description=Ubuntu Jaunty (32-bit) location=/opt/ubuntu-jaunty-32 priority=3 users=$USER groups=$USER,root root-users=root,$USER root-groups=root,wheel personality=linux32 run-setup-scripts=true run-exec-scripts=true aliases=jaunty [hit ctrl+d] # cat >/etc/schroot/mount-defaults /proc/procnonerw,bind 00 /proc/bus/usb/proc/bus/usbnonerw,bind00 /sys/sysnone rw,bind00 /dev/devnonerw,bind00 /dev/pts/dev/ptsnonerw,bind00 /dev/shm/dev/shmnonerw,bind00 /home/homenonerw,bind00 /tmp/tmpnonerw,bind00 /var/run/dbus/var/run/dbusnonerw,bind00 /usr/portage/usr/portagenonerw,bind00 [hit ctrl+d] # schroot -c jaunty (32bit)# groupadd -r staff (32bit)# apt-get update (32bit)# apt-get install sudo curl libglademm-2.4-1c2a xdg-utils libboost-date-time1.34.1 libboost-filesystem1.34.1 libboost-iostreams1.34.1 libboost-regex1.34.1 libboost-signals1.34.1 libboost-thread1.34.1 (32bit)# dpkg -i $DOWNLOAD_DIR/amazonmp3.deb
Note that I didn’t just type all this verbatim… this was just my memory of what I did. So if something’s missing, please leave a note in the comments and I’ll update this.
Next you can try running “amazonmp3” to test it. If that works, you can go back out to your “real” system (just type “exit” in that shell), and do this:
# mkdir -p /usr/local/bin # cat >/usr/local/bin/amazonmp3 #!/bin/bash schroot -c jaunty -p /usr/bin/amazonmp3 -- "$@" [hit ctrl+d] # chmod +x amazonmp3
This creates a script in your “real” system that will chain to the 32bit amazonmp3 binary in your Jaunty chroot. You can set up your browser of choice to automatically launch this script when you download .amz files. At this point you can try running “amazonmp3” from your “real” system (outside the chroot) and see if that works.
There are also a few other things:
-
If you are running a system that uses GDM to log in, you may need to add /var/run/gdm to the bind mounts in the mount-defaults file or else apps started in your chroot won’t be able to connect to your X server.
-
If you’re using non-default gtk2 theme engines on your “real” desktop”, you’ll need to install them in the chroot (via apt-get) as well. Well, ok, you don’t have to, but if you don’t, the Amazon app will look uglier than it should.
-
Remember to always pass the “-p” option to schroot. If you don’t, the environment in the chroot will get reset, which means you’ll lose your DISPLAY env var, and you won’t be able to connect to the X server without manually setting it.
-
When I first ran the apt-get command in the chroot, I got some weird errors at the end of the process about some packages not being configured because another package (gtk, I think) that it depended on hadn’t been configured yet. Just running the same apt-get command a couple times fixed it, strangely.
-
Make sure your “real” system has /usr/local/bin in the PATH.
Anyhow, that’s it. Works like a charm.
Amazon MP3 Downloader on 64bit Gentoo Linux
Update 2010/12/04: A commenter recommended clamz instead. I've installed it but not yet tried it, but it's certainly easier than installing another OS in a chroot.
(This is going to be a bit of a narrative. If you're impatient, scroll to the "How-To" section at the bottom of the post.)
Today I decided to download an MP3 album from Amazon. I actually wanted all the songs on the particular album, and noted that you save a couple bucks by downloading the whole album vs. downloading each individual song. So click through, and find that it requires the Amazon Download Manager thingo.
Lame, I think. I click the download link, and it actually gives me some buttons to choose from that have to do with Linux. Huh. Nice work. However, I assume it's closed-source proprietary crap. But hey, why not give it a try.
My choices are two .deb files, one for Ubuntu Jaunty, and one for Debian 5, or two .rpm files, one for Fedora 11, and one for OpenSuse somethingorother.
So I grab the Ubuntu one. I'm on Gentoo, so I "emerge dpkg", and then run "dpkg -x amazonmp3.deb ." in an empty directory. I look in usr/bin that it created, and find a binary. But it's a 32bit binary.
Crap.
I run 'ldd' on it, and of course it needs gtk and a bunch of other stuff that I don't have 32bit libraries for. Like boost.
So I think, ok, I can install a 32bit chroot. So I download the stage3 Gentoo i686 tarball and unpack it in /opt/gentoo32. I also "emerge schroot" in my regular system, and set that up. I recently found schroot while using Ubuntu at work. It's awesome. Eventually the stage3 tarball finishes up, so I schroot into my new 32bit environment and "emerge libboost". After it's finished, I note a problem. Amazon's binary is expecting some weird version of boost that has "gcc42" in the filename. Also, I just installed boost 1.35, and it wants 1.34. Out of desperation, I try to make symlinks to the correct file names, assuming it probably won't work. I was right: it doesn't work. Balls.
Then I think... well, why not install a chroot of 32bit Ubuntu Jaunty? I "emerge debootstrap" and pray... yep, it's in portage, excellent. I install it, schroot into it, and apt-get a bunch of the libboost packages, and... holy crap, it works.
How-To
Here's a step-by-step. This is for Gentoo, but it should work equally well on any system where you can install debootstrap and chroot. The following instructions assume you've installed them already.
As root on the "main" system:
# mkdir -p /opt/ubuntu-jaunty-32 # debootstrap --arch i386 jaunty /opt/ubuntu-jaunty-32 http://archive.ubuntu.com/ubuntu/ # cat >/etc/schroot/chroot.d/jaunty32.conf [ubuntu-jaunty-32] type=directory description=Ubuntu Jaunty (32-bit) location=/opt/ubuntu-jaunty-32 priority=3 users=$USER groups=$USER,root root-users=root,$USER root-groups=root,wheel personality=linux32 run-setup-scripts=true run-exec-scripts=true aliases=jaunty [hit ctrl+d] # cat >/etc/schroot/mount-defaults /proc/procnonerw,bind 00 /proc/bus/usb/proc/bus/usbnonerw,bind00 /sys/sysnone rw,bind00 /dev/devnonerw,bind00 /dev/pts/dev/ptsnonerw,bind00 /dev/shm/dev/shmnonerw,bind00 /home/homenonerw,bind00 /tmp/tmpnonerw,bind00 /var/run/dbus/var/run/dbusnonerw,bind00 /usr/portage/usr/portagenonerw,bind00 [hit ctrl+d] # schroot -c jaunty (32bit)# groupadd -r staff (32bit)# apt-get update (32bit)# apt-get install sudo curl libglademm-2.4-1c2a xdg-utils libboost-date-time1.34.1 libboost-filesystem1.34.1 libboost-iostreams1.34.1 libboost-regex1.34.1 libboost-signals1.34.1 libboost-thread1.34.1 (32bit)# dpkg -i $DOWNLOAD_DIR/amazonmp3.deb
Note that I didn't just type all this verbatim... this was just my memory of what I did. So if something's missing, please leave a note in the comments and I'll update this.
Next you can try running "amazonmp3" to test it. If that works, you can go back out to your "real" system (just type "exit" in that shell), and do this:
# mkdir -p /usr/local/bin # cat >/usr/local/bin/amazonmp3 #!/bin/bash schroot -c jaunty -p /usr/bin/amazonmp3 -- "$@" [hit ctrl+d] # chmod +x amazonmp3
This creates a script in your "real" system that will chain to the 32bit amazonmp3 binary in your Jaunty chroot. You can set up your browser of choice to automatically launch this script when you download .amz files. At this point you can try running "amazonmp3" from your "real" system (outside the chroot) and see if that works.
There are also a few other things: 1. If you are running a system that uses GDM to log in, you may need to add /var/run/gdm to the bind mounts in the mount-defaults file or else apps started in your chroot won't be able to connect to your X server.
If you're using non-default gtk2 theme engines on your "real" desktop", you'll need to install them in the chroot (via apt-get) as well. Well, ok, you don't have to, but if you don't, the Amazon app will look uglier than it should.
Remember to always pass the "-p" option to schroot. If you don't, the environment in the chroot will get reset, which means you'll lose your DISPLAY env var, and you won't be able to connect to the X server without manually setting it.
When I first ran the apt-get command in the chroot, I got some weird errors at the end of the process about some packages not being configured because another package (gtk, I think) that it depended on hadn't been configured yet. Just running the same apt-get command a couple times fixed it, strangely.
Make sure your "real" system has /usr/local/bin in the PATH.
Anyhow, that's it. Works like a charm.
Amazon MP3 Downloader on 64bit Gentoo Linux
(This is going to be a bit of a narrative. If you’re impatient, scroll to the “How-To” section at the bottom of the post.)
Today I decided to download an MP3 album from Amazon. I actually wanted all the songs on the particular album, and noted that you save a couple bucks by downloading the whole album vs. downloading each individual song. So click through, and find that it requires the Amazon Download Manager thingo.
Lame, I think. I click the download link, and it actually gives me some buttons to choose from that have to do with Linux. Huh. Nice work. However, I assume it’s closed-source proprietary crap. But hey, why not give it a try.
My choices are two .deb files, one for Ubuntu Jaunty, and one for Debian 5, or two .rpm files, one for Fedora 11, and one for OpenSuse somethingorother.
So I grab the Ubuntu one. I’m on Gentoo, so I “emerge dpkg”, and then run “dpkg -x amazonmp3.deb .” in an empty directory. I look in usr/bin that it created, and find a binary. But it’s a 32bit binary.
Crap.
I run ‘ldd’ on it, and of course it needs gtk and a bunch of other stuff that I don’t have 32bit libraries for. Like boost.
So I think, ok, I can install a 32bit chroot. So I download the stage3 Gentoo i686 tarball and unpack it in /opt/gentoo32. I also “emerge schroot” in my regular system, and set that up. I recently found schroot while using Ubuntu at work. It’s awesome. Eventually the stage3 tarball finishes up, so I schroot into my new 32bit environment and “emerge libboost”. After it’s finished, I note a problem. Amazon’s binary is expecting some weird version of boost that has “gcc42″ in the filename. Also, I just installed boost 1.35, and it wants 1.34. Out of desperation, I try to make symlinks to the correct file names, assuming it probably won’t work. I was right: it doesn’t work. Balls.
Then I think… well, why not install a chroot of 32bit Ubuntu Jaunty? I “emerge debootstrap” and pray… yep, it’s in portage, excellent. I install it, schroot into it, and apt-get a bunch of the libboost packages, and… holy crap, it works.
How-To
Here’s a step-by-step. This is for Gentoo, but it should work equally well on any system where you can install debootstrap and chroot. The following instructions assume you’ve installed them already.
As root on the “main” system:
# mkdir -p /opt/ubuntu-jaunty-32 # debootstrap --arch i386 jaunty /opt/ubuntu-jaunty-32 http://archive.ubuntu.com/ubuntu/ # cat >/etc/schroot/chroot.d/jaunty32.conf [ubuntu-jaunty-32] type=directory description=Ubuntu Jaunty (32-bit) location=/opt/ubuntu-jaunty-32 priority=3 users=$USER groups=$USER,root root-users=root,$USER root-groups=root,wheel personality=linux32 run-setup-scripts=true run-exec-scripts=true aliases=jaunty [hit ctrl+d] # cat >/etc/schroot/mount-defaults /proc /proc none rw,bind 0 0 /proc/bus/usb /proc/bus/usb none rw,bind 0 0 /sys /sys none rw,bind 0 0 /dev /dev none rw,bind 0 0 /dev/pts /dev/pts none rw,bind 0 0 /dev/shm /dev/shm none rw,bind 0 0 /home /home none rw,bind 0 0 /tmp /tmp none rw,bind 0 0 /var/run/dbus /var/run/dbus none rw,bind 0 0 /usr/portage /usr/portage none rw,bind 0 0 [hit ctrl+d] # schroot -c jaunty (32bit)# groupadd -r staff (32bit)# apt-get update (32bit)# apt-get install sudo curl libglademm-2.4-1c2a xdg-utils libboost-date-time1.34.1 libboost-filesystem1.34.1 libboost-iostreams1.34.1 libboost-regex1.34.1 libboost-signals1.34.1 libboost-thread1.34.1 (32bit)# dpkg -i $DOWNLOAD_DIR/amazonmp3.deb
Note that I didn’t just type all this verbatim… this was just my memory of what I did. So if something’s missing, please leave a note in the comments and I’ll update this.
Next you can try running “amazonmp3″ to test it. If that works, you can go back out to your “real” system (just type “exit” in that shell), and do this:
# mkdir -p /usr/local/bin # cat >/usr/local/bin/amazonmp3 #!/bin/bash schroot -c jaunty -p /usr/bin/amazonmp3 -- "$@" [hit ctrl+d] # chmod +x amazonmp3
This creates a script in your “real” system that will chain to the 32bit amazonmp3 binary in your Jaunty chroot. You can set up your browser of choice to automatically launch this script when you download .amz files. At this point you can try running “amazonmp3″ from your “real” system (outside the chroot) and see if that works.
There are also a few other things:
- If you are running a system that uses GDM to log in, you may need to add /var/run/gdm to the bind mounts in the mount-defaults file or else apps started in your chroot won’t be able to connect to your X server.
- If you’re using non-default gtk2 theme engines on your “real” desktop”, you’ll need to install them in the chroot (via apt-get) as well. Well, ok, you don’t have to, but if you don’t, the Amazon app will look uglier than it should.
- Remember to always pass the “-p” option to schroot. If you don’t, the environment in the chroot will get reset, which means you’ll lose your DISPLAY env var, and you won’t be able to connect to the X server without manually setting it.
- When I first ran the apt-get command in the chroot, I got some weird errors at the end of the process about some packages not being configured because another package (gtk, I think) that it depended on hadn’t been configured yet. Just running the same apt-get command a couple times fixed it, strangely.
- Make sure your “real” system has /usr/local/bin in the PATH.
Anyhow, that’s it. Works like a charm.
Messing up with Vala (again)
First some good news. I didn't look close enough into the possibilities offered by Automake 1.11 when I first wrote the post about building Vala projects. Automake 1.11 is all about making releases without the end-users having to compile Vala! Just like it is written in the Automake documentation. From now on I will always apply this wherever it is possible.I updated the Xfce4 Vala bindings with libraries from the 4.7 stack. In there I have updated the panel plugin example, and as you can see the Automake file is extremely short. When there is a SOURCES defined with a Vala file, Automake will create targets for each compiled program or library with Vala compilation, and generate one vala.stamp file per target. This has its pros and cons. In the case of the Notes plugin, this disallowed me to have a mix of only C written software and Vala inside the same directory. In reality I used to have a single main file for the panel plugin to compile to C either for the 4.7 version or prior. Automake makes the Vala specific targets visible outside the scope of the "if PANEL47 ... else ... end" block. I ended up with self-compiled Vala for each target in maintainer mode only, as previously, which is a small overhead for the specific targets.
Other nice thing about Vala is that bindings are just files. I compiled the Notes plugin for the Xfce 4.6 panel on my netbook just to verify everything is alright but unfortunately there were some problems. I bumped the required version of Vala to 0.7.8 which has GTK+ bindings for 2.18 already while I only have GTK+ 2.16 available. The simple thing to do was to download the GTK+ bindings from the version of Vala I used previously and copy them into a location of the project (or system wide). As long as the Vala compiler knows where to pick them up (with "--vapidir=") it will choose them and not the ones provided by default. This makes it awesomely easy to provide customized bindings for example.
Vala can always be very time consuming, but I still like it! Just like git merge by the way.
Xfce4 Settings hacking
I started to hack a bit on Xfce4 Settings: I have a branch ready for review implementing a clipboard manager and started a branch to improve Xfce4 Settings Editor.
The clipboard manager allows the system to have a persistent clipboard. When you copy some text or an image and close the application where you copied it, the contents of the clipboard is no longer lost. I was able to add this functionality quickly thanks to the amazing work of Mike Massonnet in Xfce4 Clipman Plugin.
The settings editor is now able to edit existing properties, to rename them, to reset them to their default value or to remove them if there is no default value. It also monitors the channels to detect property changes and to update the view automatically and remembers the window geometry so that you don't have to resize the windows and the columns every time. I still need to work on adding new properties and improving the channel stuff: adding, removing or renaming channels should be possible in the future.
Amazon MP3 Downloader on 64bit Gentoo Linux
(This is going to be a bit of a narrative. If you’re impatient, scroll to the “How-To” section at the bottom of the post.) Today I decided to download an MP3 album from Amazon. I actually wanted all the songs on the particular album, and noted that you save a couple bucks by downloading the [...]It’s a boy!
Last wednesday I became father for the second time. It’s a boy and his name is Guido. Me, his mom and his big sister Leonie are the happiest people in the world right now.
Here’s a screenshot, err, a picture of him just having found his own thumb:
Don’t expect anything Xfce-related from me any time soon…
Donations, FOSDEM
It’s been a while that I used PayPal for anything, so it came as a nice surprise that when I logged in yesterday I was presented with 60€ worth of donations for Thunar and Xfce as a whole. Thanks to Michael Gstettenbauer, James Wallen and Alin Anton (I hope the names are correct), you guys rock!
Edit: Of course this money will be used for Xfce activities and stuff exclusively, not for my own private expenses. ;)
Another interesting piece of information I noticed last night is that despite our inactivity with regards to FOSDEM, there is a developer room reserved for cross desktop talks at next year’s event. I haven’t talked to anyone yet but since they excplicitely mention Xfce as possible participants, I guess there still is a chance for one or two presentations related to Xfce. Anything you’d like us to talk about?