Dion Moult Seriously who ever reads this description.

Showing your activity: a plasma widget hack

I like activities. However there are a couple gripes I have with its implementation.

The first is how to switch from one activity to another. Apparently there are at least 7 ways to switch activities already, but all of them fail to simultaneously satisfy two criteria: 1) Being accessible via a keyboard shortcut and 2) visually display an activity list during the switch. The closest implementation is Meta-Q, but that doesn’t show an activity list during the switch like KWin’s switcher does, meaning exactly what order you’re flipping through is anybody’s guess. The Activities widget also comes close in providing a very comprehensive view to manage activities.

Luckily, you can combine the two to somewhat solve this problem in a Meta-Q, Meta-(Shift)-Tab, Meta-Q sequence, but it’s clunky and slow.

The second gripe is that it’s very difficult to tell exactly what activity you’re actually currently on. The only place which says so clearly is on a tab on the desktop, and if you’re busy actually using your computer, that tab is going to be hidden most of the time. Another hint might be due to the change of hue underneath your panel if you use a translucent panel with different wallpapers for each activity – but I personally don’t use different wallpapers. The final hint is due to seeing what other windows crop up when you switch activities, but this is slow to process. This isn’t a problem when only switching between two activites, but three and up become an issue.

It’s vital to be able to always see what activity you’re on. After coming back from a 10 minute break, you might start up another app with it being irrelevant to the current activity. Or you might make detours from your current line of work which means you want to quickly switch between several activities, and Meta-Q’s guesswork doesn’t make this efficient at all. It has to be always in front of you, too, not auto-hidden in a separate panel – especially if you’re doing a lot of typing with keyboard shortcuts so you don’t waste time looking at it or having to remember from the last time you opened an activity switcher interface.

Long story short, I got fed up and decided to make a plasma widget for it. Only barely knowing Python and never opened the Qt or KDE/Plasma docs in my life didn’t help, but I was shocked at how easy it was. After a few hours I’d got something both functional as well as somewhat aesthetically-decent.

kde activities plasma widget

Code is available here – download my plasma widget whichactivity. It’s guaranteed to make real programmers cry.

To install, just plasmapkg -i whichactivity.zip. To uninstall, plasmapkg -r whichactivity. Code is in contents/code/whichactivity.py – you might want to change the colours / icon depending on your theme.


4 Comments

Migue Chan says: (6 July 2012)

Challenge accepted…
Going to install and comment later ;D

Dion Moult says: (6 July 2012)

Cheers Migue :) A few people on IRC tried it and apparently it works fine, let me know how it goes :)

Ansgar says: (6 July 2012)

It seems as if there are problems with umlauts and probably other special characters.
In my case, for example, “Neue Aktivität” is changed to “Neue AktivitÃ⁠¤t”.

Dion Moult says: (6 July 2012)

@Ansgar:

Ah – good catch! It can be fixed by doing activityName = QString().fromUtf8(activityName) before the setText (and the same for the activity variable in the dataUpdated function).

I’ve reuploaded whichactivity.zip – so reinstall it and it should work fine.

Leave a Comment