
Copyright © 2011 Subhashish Pradhan
Copyright © 2012 T.C. Hollingsworth
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
Table of Contents
The Custom Shortcuts System Settings module allows you to configure custom keyboard shortcuts and mouse gestures. You can use them to control applications, run specific commands, and more.

The module allows to you to sort related shortcuts into Groups. For
instance, if you have some shortcuts that relate to your music player, you
could create a group for them called Music Player
.
To add a new group, click on the button below the left pane and select the option.
To add a new shortcut, click on the button below the left pane and select the option.
The first menu that appears allows you to select the type of trigger. The following options are available:
These are standard keyboard shortcuts that will be recognized anywhere, as long as a KDE Plasma Workspace is running.
Window Actions are triggers that occur when something happens to a particular window, like when it appears, gains focus, or is closed.
A mouse gesture action is triggered when a particular movement of the mouse (or touchpad or touchscreen) is performed.
Once you've selected the type of trigger, another submenu appears that allows you to select an action type. The following types are available:
This action will launch a command or open a URL when the shortcut is triggered.
This action will call a D-Bus method in a running application or system daemon. For more information, see the Introduction to D-Bus on KDE developer platform.
This action will send keyboard input to the currently running application, just as if you had typed it in yourself.
Once you've selected the action type, you can then edit the shortcut to your liking. See the section called “Modifying Shortcuts” for more information.
To delete a shortcut or group, select it, then click on the button below the left pane, and select the option.
You can export a group, so you can save the shortcuts contained within and use them on another computer or maintain a backup.
To export a group, select the group to be exported, then click on the button below the left pane and select the option, which opens a new window that lets you define some options about the exported group. The following options are available:
- Export Actions
This allows you to select the state the shortcuts will be in when they are imported later. Select Actual State to maintain their current state, Enabled to ensure they are all enabled, or Disabled to ensure they are all disabled.
- Id
Here you may enter text to identify the group. If the group is included by default, this text may be filled in by default.
- Allow Merging
This defines what happens if the group already exists on the system the exported group is imported to. When enabled, any new actions will be added to the group on the target system, while actions that have the same name but a different configuration will updated with the configuration from the imported file. When disabled, the module will refuse to import the file.
- Filename
Here you may enter the filename you wish to export the shortcut to. You may also select the
button to the right of the text box to open the File dialog and select a file from there.
Tip
Exported files use the extension
.khotkeys
by default.

In the left section of the window, the default shortcuts are categorized into groups. These groups can be expanded by clicking the arrow beside them to reveal the shortcuts.
When you click on a group, you are presented with two tabs to configure the group itself. The Comment allows you to store notes about the group, and are not actually used by the system for anything. The Conditions tab allows you to restrict which windows a group of shortcuts works with.
Conditions are displayed in a tree, the top level of which is And. All conditions beneath And must be satisfied for shortcuts in the group to be triggered.
You may add additional groups of conditions by clicking the drop down box to the right of the tree of conditions. Types of groups include the aforementioned , , in which only one member of the group must be satisfied, or , in which the inverse of all members will trigger the shortcuts in the group.
To add a window definition to the list, press the button. You may select if you want the shortcut to be triggered only if the specified window currently has focus, or you may select if you want the shortcut to be triggered as long as that window is open , regardless of whether or not you are using it. Selecting either of these options opens a window where you can edit the window definitions.
Click the button to edit an existing set of window definitions. A window opens with the window definition editor. For more information, see the section called “Defining Windows”.
To remove a window definition from the conditions list, click the button.

In the left section of the window, the default shortcuts are categorized into groups. These groups can be expanded by clicking the arrow beside them to reveal the shortcuts.
By default the groups KMenuEdit, Konqueror Gestures and Examples are installed. Applications can provide additional shortcuts, e.g. Spectacle adds a group Screenshots. This group, when expanded, reveals several shortcut configurations like Start Screenshot Tool which, when selected, reveals section on the right side, with three tabs:
The Comment tab allows you to describe how to use the shortcut, what it does, or anything else you might want to include.
The Trigger tab contains the trigger configuration, which depends on the type of trigger specified:
- Global Shortcut
To modify a keyboard shortcut, click on the button that contains a wrench, and then enter the desired keyboard shortcut. To erase the shortcut, click on the button with the
icon to the right of the change shortcut button.
- Window Action
Window actions contain several options:
- Trigger When
This configures the particular window action that must occur for the shortcut to be triggered. The following options are available:
Window appears - Triggered when a window is opened.
Window disappears - Triggered when a window is closed.
Window gets focus - Triggered when you switch to a window.
Window loses focus - Triggered when you switch away from a window.
- Window
This is where you define the actual window or windows the trigger applies to. For more information, see the section called “Defining Windows”
- Mouse Gesture
A mouse gesture can be changed by clicking the button below the area that displays the mouse gesture, which will open a window. Hold down the mouse button and draw the desired mouse gesture in the area provided. The gesture will be saved when you release the mouse button.
The Action tab is where you configure the action that will be performed when the shortcut is triggered. There are several types of actions that have different configuration options:
- Command/URL
When using a Command or URL is a trigger, a text box is provided where you may enter the command to run or URL to open when the shortcut is triggered. You may also click the
button to the right of the text box to open a file selection dialog in which you can select a file on your local or a remote system.
- D-Bus Command
The following options are provided that allow you to specify a D-Bus method to be performed:
- Remote application:
The service name of the remote application the method is to be performed on, for instance
org.kde.spectacle
if you wanted to perform it on the Spectacle screenshots utility.- Remote object:
The path to the remote object the method is to be performed on, for instance
/
for screenshot actions using Spectacle or/Document/1
, if you wanted to perform it on the first document opened in Kate.- Function:
The name of the D-Bus method to be called, for instance
Fullscreen
if you wanted to take a fullscreen screenshot orprint
if you wanted to print the document.- Arguments:
Enter additional arguments for the D-Bus method to be called.
- Call
Use this button to verify that the action works as expected.
- Launch D-Bus Browser
Launch the application QDBusViewer so browse the D-Bus methods and arguments for a running application.
For more information, see the Introduction to D-Bus on KDE developer platform.
- Send Keyboard Input
At the top of the Action tab, there is a large text entry where you may enter the keystrokes you wish to be sent when the shortcut is triggered.
Most keys contain a single character, and to enter them here you just enter that character. For instance, to type an “A”, just enter
A
. Some keys have longer names, and you can also use those names. For instance, to press the Alt key, simply enterAlt
.Individual keystrokes should be separated by a colon (
:
). For instance, to type “foo”, enterF:O:O
.Keys that need to pressed at the same time should be separated by a plus sign. For instance, to press Ctrl+C, enter
Ctrl+C
.Tip
Remember, you must enter keystrokes here exactly as you would on a keyboard. To capitalize letters, you must enter the Shift key. For instance, to type “Hello”, enter
Shift+H:E:L:L:O
.This also applies to special characters. For instance, to type the at-sign on the U.S. English keyboard layout, enter
Shift+2
.Warning
The action that is performed is dependent on the currently selected keyboard layout. If you change keyboard layouts and trigger a shortcut, it may have undesired consequences.
Beneath the keystroke entry text box, you may select which window the keystrokes will be directed to. You may choose from the following options:
Active window - The window that is currently open.
Specific window - The window that you describe using the form below. For more information on describing windows, see the section called “Defining Windows”.
Action window - When using the Window Actions trigger type, enter the keystrokes in the window that triggered the shortcut.

Several areas of the module allow you to define a list of windows. They all use the same interface, which contains the following options:
- Comment:
This is merely an informational text box you can use to explain what the trigger applies to or save other useful information. It is not actually used by the system for anything.
- Window List
Beneath the Comment box on the left is the list of all window definitions currently present in the trigger. Simply click on one to perform an operation on it.
Press this button to modify the currently selected window definition. A new window is opened that allows you to edit it. This window contains the following options:
- Window Data
This is where you describe the window the trigger should apply to.
At the top, there is a Comment: field, which is informational just like the one in the main Trigger tab.
Three window characteristics are available:
Window title: - The title that appears at the top of the window.
Window class: - Usually the name of the application.
Window role: - Usually the name of the Qt™ class that makes up the window.
Each window characteristic provides a drop-down box, and a text box below it. Enter the value you wish to test windows for in the text box. From the drop-down box, select which kind of test you wish to apply. You can use Is to require an exact match, Contains to require that the text entered be somewhere inside the full value, or Matches Regular Expression to use a regular expression to define the match. You may also perform the inverse of all these operations. Select Is Not Important if you do not wish for that particular characteristic to be examined.
The easiest way to fill in this information is to open the desired window, then click the button at the bottom of this section, and finally click on the desired trigger window. All three window characteristics will be populated with the information from that window, and you can then adjust the settings as necessary.
- Window Types
This lets you restrict the match to a particular type of window. The following options are available:
Normal - A regular application window.
Desktop - The main desktop is actually a special window all its own.
Dialog - A small window that is part of a normal application, such as a message box or a configuration screen.
Dock - A small window that can be attached or detached from a main application window.
Create a new window definition. This opens the edit dialog described above.
This creates a new window definition with the exact same specifications as the currently selected window definition. It will open the edit dialog described above so you may make further changes.
Removes the currently selected window definition.

When you first enter the module, or when you click the button below the left pane, there will be several configuration options in the right pane:
- Start the Input Actions daemon on login
This configures whether or not to activate the background application that monitors for keyboard shortcuts and triggers configured actions. It is enabled by default.
- Gestures
Select this check box to enable mouse gestures.
There are two options specific to mouse gestures:
- Timeout:
This specifies the maximum time interval during which the mouse gesture will be monitored and recognized by the system, in milliseconds.
- Mouse button:
This specifies the mouse button to be used for mouse gestures. If your mouse has more buttons, you can also use those instead.
Note
Left button is unavailable, so mouse gestures do not interfere with the normal operation of your system.

Special thanks to Google Code-In 2011 participant Subhashish Pradhan for writing much of this article.
This documentation is licensed under the terms of the GNU Free Documentation License.
This program is licensed under the terms of the GNU General Public License.