Super-speedy KDE keyboard shortcuts

6020

Author: Joe 'Zonker' Brockmeier

One of the reasons that I prefer using Vim to a word processor or GUI application is that my hands rarely need to leave the keyboard. I can do all my copying and pasting using Vim keybindings. When it comes to my window manager, I try to do the same thing — work with tools that let me use the keyboard to navigate as much as possible without having to use the mouse. If you use KDE, you can save quite a bit of time by becoming familiar with all of KDE’s shortcuts.

KDE’s shortcuts are very configurable, and KDE ships with several different shortcut schemes based on other OSes or window managers. KDE can emulate Mac OS X shortcuts, Windows, Unix, and WindowMaker, and it has its own shortcut schemes based on having three or four modifier keys. So — depending on the scheme that you choose — the shortcut to cycle through windows might be Alt-Tab, Ctrl-Tab, or Alt-F11. The functions remain the same, but you may find that your actual shortcut key is different than one discussed here. When in doubt, consult the Keyboard Shortcuts application to see which keys are assigned to a particular shortcut.

By the way, you’ll see a lot of references to keybindings, hotkeys, and shortcuts, but in this context they’re all referring to the same thing — key combinations that allow you to do something quickly. KDE’s documentation uses the term “shortcuts” throughout, so that’s what I’ll stick to. Also, the features described in this article are current as of KDE 3.5.2 — your mileage may vary if you’re running older or newer versions of KDE.

When you open the Keyboard Shortcuts module, you can select one of the default schemes from a dropdown menu, or leave it on the current scheme. You might want to create a new scheme rather than tweak the existing scheme; you can do this after you’ve made a change by clicking the Save button and assigning a name to the new scheme. The text file with the Scheme is saved under ~/.kde/share/apps/kcmkeys, in case you want to transfer your shortcuts to a new system.

To get to the KDE Control Module for shortcuts, go to the KDE menu and select Settings -> Regional & Accessibility -> Keyboard Shortcuts. Once you’re in the module, you’ll see tabs for Global Shortcuts, Shortcut Sequences, and Application Shortcuts under the Shortcut Schemes tab.

Global shortcuts and shortcut sequences

Let’s start by looking at KDE’s global shortcuts, which control global KDE actions, like manipulating windows and cycling through desktops. You’ll find these under the Global Shortcuts and Shortcut Sequences tabs. You’re probably already familiar with some of the shortcuts, such as using Alt-Tab to cycle through windows, or Ctrl-Tab if you’re a Mac user. But KDE makes it possible to do so much more than that.

For example, one shortcut that I use frequently is the Alt-F2 shortcut to launch the Run Command dialog. If I want to launch a program that has a short, easy-to-type name, it’s usually easier for me to just hit Alt-F2 and type the name of the command (like gimp or pysol) and then start using that program than to stop using the keyboard and navigate to the menu or taskbar using the mouse.

If you use multiple workspaces, you can assign shortcuts to move through the workspaces without having to click on the KDE pager window. For example, I have Ctrl-F1 through Ctrl-F4 assigned to workspaces one through four under the Shortcut Sequences tab, so pressing Ctrl-F2 changes the focus from whatever desktop I am using to desktop two. I keep browser windows open on workspace one, my mail client open in workspace two, a VMware instance open in workspace three, and so forth.

Sometimes, I want a window to be visible on all desktops, so I have Ctrl-Shift-Alt-A set to the Keep Window on All Desktop shortcut. This comes in handy for IRC and Jabber. Another handy action is Show Window List, which pops up a dialog with all the open windows across all desktops — you can get the same dialog by using the middle mouse button on the KDE desktop. This doesn’t come with a default shortcut, so I set it to Alt-l. I just hit Alt-l and then use the arrow keys to select the window I want to bring to focus.

Did you know you can move your windows within KDE without touching the mouse at all? Press Win-_ or Alt-F5, and you can move the window around with the arrow keys instead of the mouse. I also have Alt-F6 set to resize the window using the keyboard. Just press Alt-F6 and a small arrow pops up on the lower right corner of the window. The up and down arrows increase and decrease the window size.

If you’re security-conscious, you’ll probably want to get to know the Lock Session shortcut. This will blank the screen and require you to enter your user password before you can resume your KDE session. The default shortcut for this one is Alt-Ctrl-l. This is a good one to use regularly if you work in a multiuser environment, particularly if you have mischievous co-workers.

KDE has too many global shortcuts to describe them all. Take a few minutes to browse through the lists and try some of the actions to see what they do.

By the way, don’t worry about overwriting existing shortcuts. KDE will warn you if you try to set a shortcut that already exists, and give you the choice of overriding the current shortcut or setting a different shortcut.

Application shortcuts

Application shortcuts are the shortcuts used within applications, such as Ctrl-v for paste, Ctrl-c for copy, and Ctrl-s to save a file. The Keyboard Shortcut application allows you to set a shortcut for actions within applications so that the same shortcut will work across applications. So, if Ctrl-r makes more sense to you for the redo function — as opposed to Ctrl-Shift-z, which is the default in KDE — then you can simply change the keys used for that operation.

However, the application shortcuts are a bit limited. They apply only to KDE applications, which is to say that if you change the keys used for Add Bookmark, it will work within KDE apps like Konqueror, but it won’t affect Firefox’s shortcut for adding a bookmark. However, since Firefox and KDE use different defaults for adding bookmarks (Ctrl-d for Firefox, Ctrl-b for Konqueror) you could change KDE’s default to match Firefox’s if you’re more familiar with Firefox.

The application shortcuts exposed in the Keyboard Shortcuts application apply only to functions found in most KDE apps, so you may need to set or modify some shortcuts within specific applications. For example, the Detach Session function in Konsole can only be set through Konsole’s Configure Shortcuts dialog — presumably because few KDE apps actually have a “detach” function. For KDE applications with configurable shortcuts, you can get to the dialog through the Settings -> Configure Shortcuts menus.

Speaking of application shortcuts, there’s a Konqueror feature that many KDE users may not be familiar with. When you’re using Konqueror as a Web browser, if you press Ctrl it will pop up a bunch of yellow squares with letters and numbers next to the links. Press the letter or number next to the link you’re interested in, and Konqueror will load that URI. This function isn’t quite perfect yet — on some sites, Konqueror doesn’t seem to recognize every link, and if links are crowded together, it’s sometimes difficult to sort out which number or letter is connected to a given link. However, it can be really useful most of the time.

Window shortcuts

Window shortcuts are key combos that bring a specific window into focus. You can use Alt-Tab or the window menu to navigate through all of your open windows, or you can set a shortcut for the application windows you use regularly. For example, I usually set a shortcut of Win-t to bring my Konsole session into focus without having to sort through any of the other applications that may be open.

To set a window-specific shortcut, click on the top left corner of the window you want to set the shortcut for (or press Alt-F3), and select Advanced -> Window Shortcut. This will bring up a dialog that will allow you to specify a shortcut for that window.

The downside with setting the shortcut for a window is that KDE forgets the setting once you close the window. So, if you set Ctrl-Alt-F as a shortcut for Firefox, that will last only as long as the Firefox window remains open.

To make the setting permanent, go back to the window menu (Alt-F3) and select Advanced -> Special Application Settings. Then select the Preferences tab, check Shortcut, and select Remember from the pulldown menu to the right. Enter the shortcut you’d like to use in the box to the right of the pulldown menu. After you’ve saved the settings, you’ll be able to use the shortcut every time you open the application.

Launching applications

In the Keyboard Shortcuts module, you’ll see a tab for Command Shortcuts. These allow you to set shortcuts to launch an application rather than having to use the menu or click on a panel icon to start the application.

KDE doesn’t come with any command shortcuts preset by default. You can assign any application in the KDE menu a keyboard shortcut that will launch the application. Just select the application and click the Custom radio button at the bottom of the Command Shortcuts tab. Since I use the Win key for little else, I usually assign applications a Win+mnemonic key — such as Win-c for the calculator application, Win-d for the dictionary application, and so forth.

The only real complaint that I have with KDE’s shortcuts is that KDE doesn’t allow you to assign non-standard keys to launch applications or run commands. For example, I have a Logitech ergonomic keyboard with a bunch of “media” keys that aren’t recognized by applications or KDE. I can use xbindkeys to program them, but it would be much nicer if KDE would let me set the “Home” key at the top of the keyboard to launch Konqueror in my home directory, or the “Run” key to start the Run Application dialog.

According to the help text, I should be able to remap my modifier keys in the Keyboard Shortcuts Modifier Keys tab, but this doesn’t work. This is a shame, because I bet a lot of people would like an easy way to remap the Caps Lock key to something more useful — like a second Control key.

Summary

KDE exposes a great deal of functionality through its shortcuts. Take a little time to set up a workable shortcut scheme that fits your work habits, and you’ll find yourself shaving time off of repetitive tasks that you do every day.

The difference in time between using the mouse to select a window or using the keyboard may be small, but it adds up. Also, many people complain that switching between a keyboard and mouse over and over again during a normal workday tends to aggravate or contribute to repetitive strain injury (RSI). Since this is a real concern for many computer users, it’s worthwhile to learn how to avoid RSI while still being able to spend the time necessary at the computer to get the job done.