Switch to specific activities with keyboard shortcuts

Update February, 2015: Updated commands for newer versions.

Update August 17, 2013: In newer versions it’s possible to set the keyboard shortcut directly in System Settings → Shortcuts and Gestures → Global Keyboard Shortcuts → KDE component: KDE Activity Manager.

In my last post about switching between activities in KDE Plasma Workspaces I had the following on my wishlist:

  • The possibility to set a keyboard shortcut for each activity, for example Meta+F1 for the first activity, Meta+F2 for the second one etc.

This is actually already possible in 4.6, although it isn’t very straightforward for those of us who aren’t D-Bus wizards. However, since I know that there are other people who want this, I’ll share what I figured out today. After reading this post you’ll be able to set keyboard shortcuts (such as Meta+F1, Meta+F2 etc.) to switch to specific activities.

1. Find the activity id

Each activity has a globally unique identifier (GUID) which is a 32-character hexadecimal string. To get the GUID of the current activity, run the following command:

qdbus org.kde.kactivitymanagerd /ActivityManager CurrentActivity

or in newer versions:

qdbus org.kde.ActivityManager /ActivityManager/Activities CurrentActivity

Make a note of it somewhere. You can also get a list of all activity GUIDs with

qdbus org.kde.kactivitymanagerd /ActivityManager ListActivities

or in newer versions:

qdbus org.kde.ActivityManager /ActivityManager/Activities ListActivities

The list is ordered in the same way as the activities in the activity manager.

2. Create keyboard shortcuts

Now you have everything you need to create a keyboard shortcut for an activity.

  1. Go to System Settings → Common Appearance and Behavior → Shortcuts and Gestures → Custom Shortcuts.
  2. Click on Edit → New → Global Shortcut → D-Bus Command.
  3. Enter a name for the shortcut. In the Trigger tab, click on the button that says None and press the shortcut you want to use (e.g. Meta+F1).
  4. Click on the Action tab and enter the following:
    • Remote application: org.kde.kactivitymanagerd (newer versions: org.kde.ActivityManager)
    • Remote object: /ActivityManager (newer versions: /ActivityManager/Activities)
    • Function: SetCurrentActivity
    • Arguments: The GUID from the first step, e.g. a589200e-1983-4825-8275-50de36c223e5
  5. Click on Apply.

Rinse and repeat. If you want the corresponding D-Bus command, for example to use it with another application, it is

qdbus org.kde.kactivitymanagerd /ActivityManager SetCurrentActivity "GUID"

or in newer versions:

qdbus org.kde.ActivityManager /ActivityManager/Activities SetCurrentActivity "GUID"

where GUID is the GUID of the activity.

That’s basically it, have fun!


18 Responses to “Switch to specific activities with keyboard shortcuts”

  1. 7 ways to switch activities « Who Says Penguins Can't Fly? Says:

    […] Switch to specific activities with keyboard shortcuts […]

  2. alkfjl Says:

    Hey, I can’t believe how easy is this! Yes, it indeed is! Hahaaha!!! FUCK YOURSELF

  3. yadigaga Says:

    u sir just made my day – thx so much 🙂
    Here is my current setup using activities and now .. Shortcuts!!

    Another idea I had is the ability to drag&drop windows onto an activity to change it’s associated activity, or ctrl+drop to add to an additional activity (mouse centric). Alternatively a dropdown list with checkboxes in the wm’s title bar similar to the ‘Select Category’ in Kmail’s ToDo List would allow to assign several activities at once to an application. The current rightclick -> select Activities -> repeat for each activity, procedure seems quite tedious.

    When I changed my desktop layout to include activities into my workflow I wished I had the ability to move the activity panel to the left with vertical text – similar to the Kate side panel and autohide it to gain back some screen estate. Kinda got used to the current setup now but still, swapping the two would allow me in this configuration to use the standard windows titles in the task manager, not only icons.

  4. 快捷键切换特定「活动」 | I, KDE Says:

    […] /ActivityManager SetCurrentActivity "GUID"然后按键盘玩吧,骚年。via hanschen.WPSNS_main […]

  5. Erbureth Says:

    You just gave me what I needed. Kudos to you!

  6. Hans Says:

    @yadigaga and @Erbureth:
    Glad to hear that you found it useful!

    Those are pretty cool ideas, have you posted them somewhere where the developers will see them? Here they’ll most likely fall on deaf ears since I don’t have anything to do with Plasma development.

    I’m pretty sure that the UI for activities will improve in the future, hope it’s sooner rather than later. 🙂

  7. John Says:

    Brilliant. Simplicity itself. KDE 4.6 is finally doing what I want. Thanks for enlightening us all.

  8. Automatically assign numerical shortcuts to your Activites in KDE « yadigaga Says:

    […] Activites quickly when I have my fingers on the keyboard.  I stumbled across a dbus method to assign shortcuts to a specific activity . It actually works well but my problem is that I have way to many activities than I’m […]

  9. yadigaga Says:

    Your post inspired me playing around with dbus and find an easier way to automatically assign shortcuts to your activities. Here is what I came up with:


    What do you think?

  10. Hans Says:


    Nice to hear that, thank you for your comment.


    Wow, that’s very cool, thanks for sharing. I would suggest you to post it to e.g. KDE-apps.org as well as the Tutorials & Tips subforum to give it more exposure. A tip if you post it to e.g. KDE-apps is that you can export the switchActivity shortcut group – by doing so other people can simply import your exported file and don’t have to create all shortcuts manually. (Maybe you can even create an install script to do all that automatically?)

  11. Jeremiah Putnam Says:

    Thank you so much for this. Now I don’t have to fight my wife over the computer!

  12. tetris4 Says:

    I also like this Activity Manager Wheeled widget, I think it should be implemented upstream in some way:
    It enable’s you to switch between activities by scrolling you mouse over the activity widget.

  13. ypnos Says:

    I just wanted to know that this is DEPRECATED now. In global shortcuts, select KDE Activity Manager and it will provide the relevant shortcuts.

    Just to add as this page still comes up in Google Search and the other information is not as available (you need to stumble over it yourself).

  14. Hans Says:


    Thanks for the reminder, I’ve added an update at the top of the post.

  15. Henk Says:

    .. and in 2014, I cannot find the KDE component “KDE Activity Manager”, using KDE 4.14.1. So I used your method, but I replaced qdbus org.kde.kactivitymanagerd /ActivityManager ListActivities with qdbus org.kde.ActivityManager /ActivityManager/Activities ListActivities

  16. Hans Says:


    A very late reply (my apologies), but I still have “KDE Activity Manager” in 4.14.3.

    I will update the post with the new command.

  17. leoperbo Says:

    This make my day, in Kubuntu 19.04 I have a supposed way to do this via System Settings → Shortcuts and Gestures → Global Keyboard Shortcuts → Plasma, it’s more user-friendly but I can’t get it to work. Your method works like a charm.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: