docs.kde.org
Adding Keybindings for New Actions
Prev
Next

Adding Keybindings for New Actions

Most actions in either the desktop or in applications are readily available to assign a keybinding to. If the action you want a shortcut for is something you wrote yourself, or is otherwise not available, you can still assign a shortcut.

To bring together the two previous sections, perhaps you want to assign an otherwise unused key on your keyboard to a script or dcop command. Our example here will be to assign the two keys we added in the section called “Adding Extra Keybindings to KDE to go to the previous or next virtual desktop, two functions for which you will need DCOP (as discussed in the section called “Scripting the Desktop”).

This can be achieved easily using the following method:

  1. Open KControl, and in the Regional & Accessibility section, select Input Action

  2. Choose New Action

  3. Name the new action, e.g. Next Virtual Screen

  4. Select Keyboard shortcut -> Command/URL (simple) for the Action type:

  5. In the Keyboard Shortcut tab, click the button you wish to use to trigger the command. For this example, you would press the one with the Next Page picture on it. Next_Virtual_Screen will appear in the key image.

  6. In the Command/URL Settings tab, enter the command to run in the field: dcop kwin default nextDesktop

Repeat the above with the Prev_Virtual_Screen key and dcop kwin default previousDesktop.

Now pressing the Prev_Virtual_Screen or Next_Virtual_Screen will switch you to the previous or next virtual desktop, respectively.

Obviously you can assign any free key to any action.

Related Information

Prev
Next
Home


docs.kde.org