Fri Jul 02, 2010 1:15 pm
I am able to create keyboard shortcuts for Ctrl-F1 and Ctrl-F2 which launch a script using the Control Center interface, Input Actions section. The platform of interest is KDE 3.5 on CentOS 5 at present, but see later.
What I need, however, is to create the same shortcuts from a shell script, run after installation of an RPM: this RPM creates a user and then preconfigures its KDE environment completely. So far, I've been able to do stuff like
cat > kdesktoprc <<- EOM
and then upon first login the KDE setup would pick up from there just fine.
I guess what I am trying to do is preseeding this specific account, but I
don't want to interfere with any other present or future account on the
Unfortunately, I have not been able to make the same work with Input
Actions, whose configuration is somewhat more involved. Before attempting
to unravel it further, I decided to ask if there was a better way.
In other words, what is the command to create a keyboard shortcut (I don't
think I can use DCOP, because KDE would not be running at the time) ?
I skimmed hints to the kconf_update mechanism, but was unable to ascertain if it was appropriate for my use case: is there a reference available ?
Thank you in advance,
Sun Jul 04, 2010 8:35 pm
I don't think I can help with this, I'm afraid. I'm not a programmer, and I don't know any developers who work with KDE 3.5, so I don't have anyone to ask. Sorry.
I'm in Finland, at Akademy at the moment. When I get home next weekend I'll look around on my server, which is the only 3.5 installation I have, but I don't have great hopes of finding anything to help. Sorry
annew, proud to be a member of KDE forums since 2008-Oct and a KDE user since 2002.
Join us on http://userbase.kde.org
Thu Jul 22, 2010 8:13 am
I found an approach which appears to work. First, I create a .khotkeys file, call it zzz.khotkeys, and store it under /usr/hsare/apps/khotkeys. A good starting point is printscreen.khotkeys.
This file has two sections, a [Data] section with the hotkey definition(s), and a [Main] section where among other keys we have
which is used to remember which key definitions have been already imported.
To put the definitions in zzz.khotkeys into effect, you could use this
which seems to invoke functionality equivalent to the "Import" button in the "Input Actions" user interface.
This step incurs a number of obstacles in my scenario, which is running all of the abovce in the %post script of an RPM install.
First, khotkeys_update fails if it cannot contact an X server; on the surface this seems silly, as it should only need to perform text wrangling, but this can be worked around by placing its invocation in a .desktop file in .kde/Autostart.
Second, khotkeys_update does not exactly look like a published interface which can be relied upon over time; since this is for CentOS/KDE 3.5 in a context where little evolution is expected, I enjoy the privilege to consider this a minor issue. If there is a published (shell) interface to perform the import, I could not find it (I did not investigate DCOP).
In the end, the same script which directly customized other configuration
files under .kde/share/config also adds under .kde/Autostart a file name zzz-keys.desktop which looks like
which gets the hotkeys added the first time (they end up inside khotkeysrc) and is skipped on subsequent invocations, because khotkeysrc includes a key name AlreadyInstalled which is also updated to include "zzz", so on subsequent runs khotkeys_update finds it and does not add duplicates.
Maybe someone will find the above useful