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:
-
Open KControl, and in the
Regional & Accessibility
section, select
Input Action
-
Choose
New Action
-
Name the new action, e.g.
Next Virtual
Screen
-
Select
Keyboard shortcut -> Command/URL (simple)
for the
Action type:
-
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.
-
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.