Archive for the ‘KDE’ Category

Help wanted: Photoshop

1st March 2015

As part of KDE Frameworks, we have a collection of QImage plugins that allow Qt applications to read various types of image files not natively supported by Qt. I’ve recently overhauled the one that reads Photoshop images (PSD files) but, without access to Photoshop, I have no way to create images that test the code. The one test image I have, I created using the Gimp, which is less than ideal when I want to test compatibility with Photoshop itself.

So, if you have access to Photoshop (Photoshop Elements might be sufficient, I’m not sure) and would be willing to make some test images (in pairs – one PSD, one PNG) of various specific configurations and in various save formats, please do get in touch (alexmerry at kde dot org, alexmerry on IRC, or just post a comment here).

To the extent that the simple images I require would be copyrightable, you would need to be willing to license them under the LGPLv2+ or a permissive license (CC-BY-SA would be fine, for example).

New installation variables

13th January 2015

I noticed a while ago that the CMake installation variable names used by KDE projects (defined either in kdelibs or KDEInstallDirs in extra-cmake-modules) are inconsistent with what GNUInstallDirs, for example, uses. The traditional variable names are things like BIN_INSTALL_DIR and CMAKECONFIG_INSTALL_PREFIX, while GNUInstallDirs defines things like CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_DOCDIR.

In an effort to make the installation variables more consistent and compatible with GNUInstallDirs (for the ease of packagers and developers alike), I introduced GNUInstallDirs-style variables to KDEInstallDirs – this included the variables defined by GNUInstallDirs and other ones beginning CMAKE_INSTALL_. These were kept in sync with the old-style variable names.

Both of these styles of variables have namespacing problems: the ones starting CMAKE_ tread on CMake’s namespace (so CMake could potentially define one of those variables that doesn’t appear in GNUInstallDirs to have a different meaning), and the old-style variables are very generic and could conflict with another CMake module. Neither of these are likely to be an issue in reality, but it is good practice to respect namespaces in third-party modules.

KDEInstallDirs now primarily defines variables starting with KDE_INSTALL_ (which corresponds with the module name). The old-style names and all the CMAKE_INSTALL_ names that do not also exist in GNUInstallDirs are deprecated, and can be disabled entirely (see the documentation). It is possible to disable the variables that appear in GNUInstallDirs as well.

This appeared in extra-cmake-modules 1.6.0, but that version had some flaws (for example, it would break if you used both GNUInstallDirs and KDEInstallDirs in the same project, which was a major oversight), so you should use 1.6.1 instead.

There is a script in the kf5 directory of the kde-dev-scripts.git repository to port your CMakeLists.txt files to the new variables: Just run it in a directory with a CMakeLists.txt file.

return EBUSY;

8th September 2014

I just want to apologise to those of you who are waiting on me for Review Requests, etc. Last month was quite busy for me, and this month is even more so – all good things, such as friends getting married, but all time-consuming. On top of that, Akonadi and the server I use for KDE-related email have decided they aren’t talking to one another, which makes it that bit harder to deal with (due to having to log into, and then deal with the interface of, webmail).

I’m expecting life to calm down considerably in October, so hopefully normal server should resume then.

Qt5 Pretty Printers for GDB

4th June 2014

If you’ve ever debugged a Qt program in GDB and been frustrated when attempting to print a QString gives you an unhelpful result like

$1 = {d = 0x6e7c40}

then kde-dev-scripts has some useful tools for you. For some time now, there has been the kde-devel-gdb script, which you can include in your ~/.gdbinit. This gives you commands like “printq4string” and “printq5string” which will dump the actual string contents of a QString.

However, GDB 7 has the ability to add pretty-printers written in Python. This means that you can control how a value is output when you use “print” and when backtraces are printed. So “print someQString” will actually write out the string for you.

The gdb directory of kde-dev-scripts now has some of these pretty-printers for Qt5. Currently, it covers most of the main value classes and collection classes in QtCore (QByteArray, QString, QStringList, QList, QMap, etc). QHash and QSet are the most notable ones that are missing.

To use these pretty-printers, you either need to source the “” file in your GDB session, or use the “” script to generate files that will allow GDB to auto-load the printers when it loads the Qt5 libraries.

I plan to eventually submit these to Qt, so that pretty-printing of Qt value classes will work out of the box. For now, do let me know if you run into any issues with them (don’t forget to compile your application with debugging symbols!), and feel free to extend what’s there, or use it as a template for some Qt4 pretty-printers.

MPRIS2 and the Music Player Daemon

17th May 2012

If you tend to want to keep your music running when you log out, or control your music playing on a desktop machine from a laptop, for example, you may well use the Music Player Daemon (MPD).  If you use Ubuntu’s Unity desktop or KDE’s Plasma desktop, you may well wonder how to get the Ubuntu sound menu or Plasma’s Now Playing widget to talk to it.

Both of these use MPRIS2 to communicate with media players.  MPD, however, does not have an MPRIS2 interface.  Even if it did, it would take a bit of work to be able to use it from another computer.  What you need, then, is a “bridge” of some sort to translate.  One such possibility is mpDris2 (which, I hasten to point out, I haven’t tested).

You would run such a bridge on the computer you want to control MPD from, and point it to your MPD instance.  And voilà!  Every MPRIS2 client application that you run can talk to MPD, without knowing anything about the MPD protocol.

If you just want a headless music player on your local machine, though, you can always use Raven, which talks MPRIS2 natively.

New Now Playing Plasmoid, MPRIS2 dataengine

11th May 2012

One thing that will be in KDE Plasma Desktop 4.9 is a new version of the Now Playing widget.  Based on QML, it works much better, especially on panels (where its design is based heavily on my favourite KDE-3-era applet, kirocker).

Now Playing on a panel

In the background, it uses the new mpris2 dataengine.  This exclusively supports MPRIS2-capable media players (which these days is most), and doesn’t include any hacks to support XMMS 1, for example.  JuK and Dragon have both gained MPRIS2 support for the 4.9 release, and Ubuntu’s sound menu uses MPRIS2, which is compelling many other media players to support it.

Now Playing on the desktop

The result is a cleaner, more reliable design, and completely asynchronous behaviour, so it will use less power and (unlike the old nowplaying dataengine) it should never cause your desktop to freeze due to a badly-behaving media player.

Now Playing with the mouse over

The old nowplaying dataengine is still there (and will be until KDE Plasma Desktop 5 is released), but should not be used for new widgets.  Instead, you should use the mpris2 dataengine, and I highly recommend porting any existing widgets to mpris2 as well.

Overall, I’m really pleased with the design of MPRIS2, which allowed me to create the mpris2 dataengine with a minimum of fuss, and allowed for widgets to implement a seek bar without querying the media player once or twice a second to find the current position (and not take the performance/power hit if they didn’t care about the current playback position).

MPRIS2 Support in NowPlaying

10th November 2011

Do you recall NowPlaying?  The dataengine/widget pair for Plasma that tells you what your media player is currently playing, and allows you to control it?

The Now Playing widget (with an old theme)

Well, now it supports MPRIS2.  What does this mean for you?

Well, probably not much right now.  Juk doesn’t support MPRIS2 (although I intend to change that for 4.9/5.0), Amarok worked before (although it should use marginally less power with MPRIS2 rather than the old MPRIS interface), VLC doesn’t support MPRIS2 (yet; version 1.2 will).  A handful of other players support MPRIS2, though, including the Raven Music Server.

The main thing, though, is that support for MPRIS2 is increasing in media players, partly because of Ubuntu’s adoption of it as the mechanism for its sound menu to talk to media players.  Spotify now supports MPRIS2, for example.  And now the Now Playing widget can support them.

MPRIS2 has many advantages over the original MPRIS specification, not least of which is not having to query the media player every second for up-to-date position information.  As a result, the nowplaying dataengine will prefer the MPRIS2 interface to the MPRIS interface for a media player that offers both.

The only quirk to be aware of is that Amarok’s MPRIS2 support isn’t quite right in the 2.4.x series, and this will affect a couple of features of the Now Playing widget (seeking and enabling/disabling of the next/previous buttons); this shouldn’t be an issue though, as these problems are fixed for Amarok 2.5, which will be released before KDE Plasma Workspace 4.8.

Screen locking with the Plasma netbook interface

4th September 2011

If you are using the Plasma desktop on your netbook in “netbook mode”, you may have noticed that screen locking (in all its forms – the Ctrl+Alt+L shortcut, typing “lock” into search-and-run, and automatic locking when suspending to RAM or when the screensaver starts) no longer works.  This is because KRunner doesn’t run in this case, and KRunner is (somewhat bizarrely) responsible for activating the screen locker.

The proper solution to this (and the one that should be implemented for 4.8, hopefully) is to get KWin to manage screen locking.  After all, it knows best when it comes to managing the screen.  But, until then, you can use the quick hack I came up with: putting screen locking into a kded module.

This works quite nicely with existing installations, as you can just compile and install the KDED module and be on your way.  One caveat: KRunner will retain the shortcut.  Once you’ve started the module for the first time (either from the Service Manager kcm or by logging out and in again), you will need to go to the Global Keyboard Shortcuts kcm and set Lock Session shortcut for KDE Dæmon.

Run the following commands to do this (you’ll need cmake and automoc, as well as development packages for Xorg and kdelibs):

git clone git://
cmake ../kscreenlockmgr -DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix)
sudo make install

Or, if you’re on ArchLinux, just grab kscreenlockmgr-git from AUR.

Desktop Summit Discussion List

8th June 2011

I’ve been looking for people to share accommodation with at the upcoming Desktop Summit (comment on this post if you’re in the same position!), and was pointed towards the ds-discuss list, which I wasn’t aware of (and apparently has no posts in its archive).  So I thought I’d spread the word.

It appears that if you’ve registered for the desktop summit, you should already be on the ds-announce list, but you have to manually sign up for the ds-discuss list.  Don’t forget the #desktopsummit IRC channel as well.

I'm going to the Desktop Summit 2011

Busy Day

1st April 2011

Today is clearly a busy day in the world of technology.  Several major projects have been unveiled, including:

Know about any other exciting new developments announced this morning?  Post in the comments!

(Also of interest: invisibility cloak stolen from lab).


Get every new post delivered to your Inbox.