You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, September 3rd 2006, 9:40am

scriptable keyboard?

hi

after a couple of years of using fedora as a system for just doing backups from windows machines, i've installed Kubuntu on my main machine... been here a couple of weeks...

back on windows i use autohotkey (www.autohotkey.com) to put functions on keys. a lot of them go something like:

if MyApplication exists:
go to its window
else:
start MyApplication


...and then i have keyboard definitions all over the place. the right-control key takes me to firefox, printscreen takes me to mail, capslock takes me to my file manager, and so on. i don't use the mouse much.

since arriving in KDE-land i am using the mouse all the time!

can somebody please give me an indication of how i can put an app on a key without getting a new copy of the app every time i press the key?


jack

bram85

Professional

Posts: 948

Location: Eindhoven

Occupation: Software Engineer

  • Send private message

2

Sunday, September 3rd 2006, 10:16am

RE: scriptable keyboard?

In KDE you cannot assign special functions to the right control key or Caps Lock. You can only attach something to Print Screen.

First off, you should write a Bash script. I'll take Kopete as an example.

Source code

1
2
3
4
5
6
export DISPLAY=:0
if pgrep kopete; then
  dcop kwin default setCurrentDesktop 3
else
  kopete &
fi


A second note, which is really worth mentioning, is that it is not possible to move to the right desktop with a given window. In the script, I assume that Kopete always should reside on desktop 3. You can enforce Kopete to start there with window specific rules (right click on random title bar, Configure Window Behaviour->Window Specific Settings).

Once you created the script, add an entry for this in the K Menu. Run kmenueedit, create an entry pointing to that script. There you can also assign a shortcut.
Bram Schoenmakers
KDE Netherlands (www.kde.nl)

3

Sunday, September 3rd 2006, 12:23pm

hi bram

that's pretty good and i can work with those restrictions.

what would be nice is to be able to give focus the to the target application. is that possible? in other words, if i have more than one application open on a desktop, changing to that desktop takes me to whatever application had focus the last time i was there.

but you've got me started :)

many thanks


jack