KDE 4.x: Global hotkeys for all users - how to do it?

Using KDE 4.6+, I’d like to have a predefined set of hotkeys for all users of the computer. E.g. the “XF86Calculator”-key starting “kcalc” as a default for all users without everyone being forced to deal with the absolutely messy and un-intuitive KDE hotkey configuration. Is there a way to do that? Preferably something like an “*.desktop”-file in /usr/local in order to be consistent with the rest of the system.

First, define the hotkeys in KDE like you would do for a single user. Then copy the files kglobalshortcutsrc and khotkeysrc in /etc/skel/.kde4/share/config. When you create a new user, these files are copied to his ~/.kde4/share/config directory. All files and directory in /etc/skel must belong to user root and group root. So if you create these files as user you have to change their ownership:


su -l 
mkdir -p /etc/skel/.kde4/share/config
cp ~/.kde/share/config/kglobalshortcutsrc /etc/skel/.kde4/share/config
cp ~/.kde/share/config/khotkeysrc /etc/skel/.kde4/share/config
chown root:root /etc/skel/.kde4/share/config/*

Is there a way to do this for already existing users?

You can set up the hotkeys once and copy these two files to the ~/.kde4/share/config directory of each user. But don’t forget to change the user/group ownership of these files to each user.

What I dislike in this solution is that I would also change hotkey changes a user has already done individually in the monolithic configuration files. OK, would probably be not much of a problem, as probably up to now nobody has made any individual configuration change in my “mini setup”. However, not very elegant.

When I want to define standard applications for mimetypes system-wide, KDE at least gives me the workaround of “doubling” the corresponding *.desktop-files under the /usr/local/share/ hierarchy with modified priorities. Is there no solution like this for other KDE settings like hotkeys?

Yes. :frowning:

That’s a totally different problem. You can change the system-wide location of .desktop files and menus by setting and exporting the variables XDG_DATA_DIRS and XDG_CONFIG_DIRS. None of the menus I set up, whether in KDE, Gnome, XFCE or LXDE look like the standard menus created by the different distros. :open_mouth:

You’ll find the complete documentation on Freedesktop’s website: Desktop Menu Specification

I may be mistaken here, but I thought that /usr/share/kde4/config/ could be used for system-wide configuration (includnig the kglobalshortcutsrc and khotkeysrc files).

It works too. I would rather put them in /usr/local/share/kde4/config so they don’t get overwritten.

It works too. I would rather put them in /usr/local/share/kde4/config so they don’t get overwritten.

Thanks for clarifying this :slight_smile:

That looks like the solution I was looking for - I didn’t think about the /usr/local/share/kde4/config directory tree. I’ll look into it.