So, after finally getting around to fixingthat annoying Plasma Task Manager bug (and I must say, I can’t wait until that applet is ported to to QML, the animation/state change code in there is a mess), I noticed a discussion on IRC about file notification APIs and how there seems to be no good in-kernel solutions at the moment. And after reading Vishesh’ blog post I got an idea for how to maybe solve it using LD_PRELOAD.
The idea is that we have a itsy bitsy library that we inject into every process, by setting LD_PRELOAD in the startkde script. This way the dynamic linker uses our custom functions instead of the normal ones. So when we LD_PRELOAD in a library with a custom rename() function (the standard C library rename() function is used for moving files), it calls our library instead of glibc. Our library in turn tries to connect over a local Unix socket to a central process, and reporting in the old and new filename/path, as well as the current working directory (in case we are working with relative paths). Finally we call the normal glibc rename() function, which does what it does best, actually move the file.
While it might initially seem like a fragile solution, I think it should be pretty reliable in practice (funny pictures aside). It might be crazy enough to actually work. The only thing that won’t work is if applications launched outside of a KDE session move files around, but they have no business moving files around in users home folders anyways (and a solution to this is to set LD_PRELOAD even earlier, for example in /etc/profile.d/ somewhere).
So I thought I’d blog about it, so I can get some useful criticism and learn why it shouldn’t be done this way.
So, scratching an itch some time ago (July 12., according to my timestamp), I went ahead and wrote a notifier for Reddit based on the simple but awesome Facebook notifier. Then it hit me that maybe there were other Reddit and KDE users that would appreciate this, so I uploaded it to my server.
So, Akademy 2012 is over. A huge thanks to everyone involved, it has been amazing. Met a lot of friends, made many new ones, attended really interesting talks about varied subjects, attended even more varied BoFs, hacked and partied. Even attended the start of the QtQuick workshop (but had to leave for the Phonon BoF before they started handing out N9s :P). A huge thanks also to the KDE e. V. so that I could attend (even without a paying job).
The most interesting results of Akademy are probably the plans for Phonon 5 (and the rest of the discussion about Phonon), the plans for KDE multimedia in general, and I finally managed to revive carewolf’s avkode project. Which is so interesting that it’ll get its own paragraphs.
Some of you may remember the aKode project from KDE 3 times, which was an audio playback framework made by Allan Sandfeld Jensen. What not so many people know is that he started working on a sibling during the KDE 4.0 times, which also supported video playback, with a corresponding Phonon backend. Unfortunately he got busy with Real Life™, and avkode was left alone in SVN for many, many years. Then along came a bored Sandsmark and first got it to build, updated it to not use outdated ffmpeg API, and rewrote most of the Phonon backend (it was written before the final version of Phonon was release, apparently, so it didn’t really match with how things are done nowadays). Then at Akademy Allan and I sat down and hacked on it a bit, to the point where I am now using it as my main Phonon backend (it seems to work well in JuK, Dragon, Amarok, file dialog previews, etc.).
I started looking into creating a tiny, minimal Phonon backend, for many reasons; firstly we are now working towards Phonon 5, so I wanted to get a fresh look on how the backend/frontend integration works, and I also got a bit tired of working around bugs in the frameworks Phonon are using. Making a backend that uses ffmpeg/xv/alsa-lib/etc. directly has been something I’ve wanted to look into for a long while now. And when I finally sat down, and looked at aKode for inspiration, I found that Allan had already done most of the work needed. So now we have a pretty minimal Phonon backend (it only depends on Qt, ffmpeg, libxv and alsa-lib), though it doesn’t support most of the advanced features available in other backends (like painting on anything other than the normal VideoWidget).
It is still kind of rough around the edges, and will probably stay like that for a while, as I plan on working more on VLC (I have plans for a KIO access module for example, so we can avoid the ugly platform plugin kio hackery with phonon-vlc). I give no guarantees for it (I’m not even sure it builds on many major distributions at all, since they apparently have started shipping the libav fork instead of proper ffmpeg). And it has no website, logo or documentation for now, though I did put up a PKGBUILD for Arch in the AUR.
Another thing that you’ll notice with avkode is that when using it playback progress bars should be smooth, since it has spatial tick emission (not properly, it assumes that all progress bars are 1024 pixels for now). Spatial tick emission is a fancy name I made up on the spot, where instead of always emitting a progress tick at fixed intervals it emits a fixed amount of ticks per media object, independent of how long it is, so that an application can get pixel-perfect progress bars.
So, after working on the cool “Large image displaying library” in KHTML I decided to look into other parts of KHTML, and work on getting my lolcat page working in KJS/KHTML. It turned out quite easy, KHTML is very friendly, both the code base and the community around it.
And as usual, thanks to the KHTML developers for help with everything.
To celebrate that KHTML now has proper support for scaled, animated gifs (as of 35526c4ddc99e684a645d5c536cdaec513cc3103), above is a dancing banana. Many a thanks to Maksim Orlovich for helping me track down various bugs related to it.
So, I don’t blog too often, but I thought I’d blog and write down the most important stuff.
Since last time I blogged, I helped write a pure-Java, Android client for the Quassel IRC client, named QuasselDroid. Not strictly a KDE project, but Quassel has very good KDE integration, and many KDE users use it. It lacks some features compared to for example Konversation, but it’s distributed so the compromise is kind of worth it. I had to reimplement the whole QVariant/QDataStream based protocol with just Java, so that was kind of fun. And it’s still one of the most-used applications on my phone, so there’s that.
I also started using Spotify, and found the excellent KDE client Spokify, found it lacked some features, so I implemented those. I think you can see all of them in the screenshot (except for the last.fm scrobbling).
Then I got bored with Spotify not having the music I listen to, so I started using JuK again. I found it missed last.fm scrobbling, so I implemented that (unfortunately liblastfm seems to be a dead project, so I had to implement it more or less from scratch, but whatever). I also fixed cover fetching in it; Yahoo has discontinued their image search API, and Google has deprecated theirs, so I switched it to fetching covers from last.fm (then I could also reuse some code from the scrobbling I implemented. I also fixed a couple of paper cuts before I got bored.
Then I got bored with all the webpages working correctly, so I found my old love, Konqueror (with KHTML). Unfortunately I spend too much time looking at cat-pictures on reddit, and since imgur shows a downscaled image by default, and KHTML only did nearest neighbour scaling (which is fast, but looks kind of crappy), I implemented a semi-quick bilinear scaling (using a trick which I think Ariya blogged about forever ago). Looking at the before and after screenshots should explain. It still looks kind of crappy for ratios over 2-ish, but it’s more than adequate for my cat picture looking.
Then I got bored of my desktop being state of the art, and remembered that there is a very nice, KDE-based lightweight alternative to krunner and plasma-desktop called “Kor Testudo“. Basically a lightweight KDE desktop, with support for plasmoids and everything (much more feature rich and less buggy than Razor Qt in my experience, even if it’s just a one-guy project). Only problem I had was that with a transparent panel it got kind of hard to read, so I implemented optional blurring support. There is an even older and more lightweight desktop alternative called Blazer, but that’s kind of unmaintained and not as feature rich as Kor, and I haven’t really tried it in a while. Last time I had to hack a bit on it just to get it to build. Just thought I’d mention it if anyone was interested.
Lastly I’ve also been using an excellent launcher/krunner replacement called Mangonel for some time now. It’s inspired by Katapult, if anyone remembers that. The only thing I was missing was the ability to launch config modules directly from it, so I implemented that (and fixed a couple of bugs and paper cuts).
Lastly I’ve started writing on my master’s thesis. We’re using a software framework called LIDA which is a generic and customizable framework written in Java for implementing cognitive/conscious systems, and are using that as a basis for our StarCraft: Brood War bot written with the help of BWAPI (an excellent free software project, under LGPL 3).