LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 06-12-2002, 05:32 PM   #1
hamsterdude
Member
 
Registered: Mar 2002
Distribution: Mandrake 8.2
Posts: 62

Rep: Reputation: 15
KDE3 execute command on keyboard shortcut


Do I need to say much more? I use KDE3, is there any way to execute a specific command when a certain set of keys is pressed (eg Alt-F1)?
Any ideas?
 
Old 06-12-2002, 05:46 PM   #2
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,154

Rep: Reputation: 56
You could edit the shortcut keys scheme in control-center.

You may want to create a script in some cases to actually perform certain functions or run commands, and make a shortcut to the script.
 
Old 06-13-2002, 01:29 AM   #3
hamsterdude
Member
 
Registered: Mar 2002
Distribution: Mandrake 8.2
Posts: 62

Original Poster
Rep: Reputation: 15
I've looked at that but there doesn't seem to be any way of adding actions, you only seem to be able to edit the keys for stuff like switching desktops
 
Old 06-13-2002, 03:12 AM   #4
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
hamsterdude, (cool name btw) if you could maybe give us an example of what you are trying to do, or an instance in which you would use something like you are talking about, maybe someone could help you further.

If you are looking to perform 3 or 4 functions with the touch of 1 button, I would make a script like DavidPhillips said. For example if you are trying to execute the same program with the same [options] each time, you could make something like this:
Code:
#!/bin/bash
prog name -option
Then you need to make it executable by: 'chmod a+x prog name'
That is a very very simple script, just an example.
Good luck

Last edited by MasterC; 06-13-2002 at 03:30 AM.
 
Old 06-13-2002, 03:24 AM   #5
hamsterdude
Member
 
Registered: Mar 2002
Distribution: Mandrake 8.2
Posts: 62

Original Poster
Rep: Reputation: 15
well, I'm trying to set up hotkeys for Xmms. Failing to find a plugin I realised that you could control it at the command line (eg 'xmms -p' is the command to make Xmms play the current song), so I thought that it would be quite useful if, say, everytime I hit Alt-F2 that the command 'xmms -p' ran and Xmms starting playing. But you don't seem to be able to do this in Kde. Does anyone know any tricks in KDE3 to run a command on a specific combination of keys.

BTW, if you like the name 'Hamsterdude' check out www.hamsterdude.com
 
Old 06-13-2002, 03:36 AM   #6
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
This probably won't help very much, but here's a shot in the dark..

I have a console based MP3player which had some messed up keybindings, like F1 was to switch to a file browsing list, F2 was to load the list and so on. Well I ran a man on the program and found out that I could switch the keybindings. So now I press p to play and so on. I bet there is something similar with XMMS. In fact, I know you can use single keys to control play and such. For example x I think is stop, v is play, and so on.

ANYWAY, to sort of answer your question, the script answer may be a way for you to get what you want. The example would read:
(I am not a programmer, just giving examples from different experiences I have used, so if anyone can clean up, or make my code better, please feel free)
Code:
cat > /usr/local/autoxmms << "EOF"
#!/bin/bash
xmms -p
EOF
Then do a chmod a+x /usr/local/autoxmms

Of course that's a simple script again. You can get very elaborate if you want. Hope this helps.

<edit>
Oh, and I forgot to mention the key part of all that. You could make a symlink in a directory in your PATH, something like:
ln -s /usr/local/autoxmms /usr/bin/PLAY

Or something like that, then when you typed PLAY it would execute your script, which would execute xmms -p and start playing. There is probably an easier way, I just don't know it.
</edit>

Last edited by MasterC; 06-13-2002 at 03:45 AM.
 
Old 06-13-2002, 03:51 AM   #7
hamsterdude
Member
 
Registered: Mar 2002
Distribution: Mandrake 8.2
Posts: 62

Original Poster
Rep: Reputation: 15
A know that when the inittab acript runs, it grabs ctrl-alt-delete for its own evil ends and then monitors that, ready to run 'reboot' or whatever. Is there anyway to do the same, so that when Alt-F1 or whatever is detected, it'll run a script?
 
Old 06-13-2002, 03:54 AM   #8
hamsterdude
Member
 
Registered: Mar 2002
Distribution: Mandrake 8.2
Posts: 62

Original Poster
Rep: Reputation: 15
here we go, found this in inittab:
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

Does anyone know if you can do the same to trap Ctrl-F1?
 
Old 06-13-2002, 05:02 AM   #9
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Looks like this mini how to might help you out. There are a few options on assigning keys, I don't know but I am assuming you will be able to set it up with one of the programs mentioned in the how to.
 
Old 07-11-2003, 08:43 AM   #10
kmc
LQ Newbie
 
Registered: Jul 2003
Posts: 3

Rep: Reputation: 0
Cool

HI
why does nobody understand hamsterdude's simple problem?
i had the same struggle.. searched for it hours and hours... there is nothing in "control center"... (i think it was there in kde1 and/or 2).
i almost started to mess around with inittab, too.
but that probably wont work anyway and it's not necessary.. if you use kmenuedit !!!
you can easily configure global kde hotkeys for executing commands there
you just have to add a custom entry for each command you need...
hth!
 
Old 07-21-2003, 02:36 PM   #11
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 30
Hey kmc!

I'm SO grateful for the tip! I've had no problem to find kmenuedit in SuSE and define my own shortcuts, but in Mandrake I was at a loss since I couldn't remember what the app was called. Great!

/Stefan

Last edited by Bebo; 07-21-2003 at 02:41 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Execute shortcut as Root Command? batorma Linux - Newbie 2 11-08-2005 02:22 PM
Trying to make keyboard sequence execute a command in Xorg ghrellin Linux - Software 1 09-02-2005 10:18 AM
Keyboard Shortcut wildcat22 Linux - General 1 09-27-2004 10:33 AM
execute/shortcut kfrancisco Linux - Software 5 09-28-2003 02:30 PM
Disabling KDE3.1 Konsole shortcut (CTRL+T) pablob Mandriva 2 09-14-2003 06:39 AM


All times are GMT -5. The time now is 07:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration