View previous topic :: View next topic |
Author |
Message |
josh Guru
Joined: 05 Feb 2003 Posts: 473 Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo
|
Posted: Mon May 02, 2005 12:28 pm Post subject: key binding question. |
|
|
I have figured out how to bind keys in X. So that I can hit the built-in "Sleep" button on my keyboard and send my computer into suspend. But I want to be able to hit that button even if I'm not using X. How would I go about doing this? Any search I do either here or at google.com/linux comes up with keybindgs for X or for various programs. Maybe it is not even possible? Although I have gotten used to the fact that you can do just about anything with GNU/Linux after tinkering around a bit. Can anyone send me in the right directions? Thanks! _________________ -Josh |
|
Back to top |
|
|
BlackEdder Advocate
Joined: 26 Apr 2004 Posts: 2588 Location: Dutch enclave in Egham, UK
|
|
Back to top |
|
|
josh Guru
Joined: 05 Feb 2003 Posts: 473 Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo
|
Posted: Mon May 02, 2005 1:56 pm Post subject: |
|
|
I tried installing it on my machine that I use as a router (it does not have x on it). And although it doesn't list x as a dependency (it is under x11-misc however) the build fails without x:
Code: | checking for X... no
configure: error: "You must have X installed" |
_________________ -Josh |
|
Back to top |
|
|
josh Guru
Joined: 05 Feb 2003 Posts: 473 Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo
|
Posted: Mon May 02, 2005 3:26 pm Post subject: |
|
|
After doing some more searching around on the web I think I should clarify. I want these key bindings to work from the console keyboard even if noone is logged onto the system. My ultimate purpose is this: I have never crashed linux. However, I have had X lock up on me. Especially using *wine (funny huh). Whenever that happens, I switch the monitor to my router and then login, then log in to my computer via ssh and kill X or wine or whatever. But it would be a whole lot simpler if I could just reach over, hit the 'windows' key on the router-keyboard and have it all done automatically. If I can map the key to a specific command, then this won't be a problem. _________________ -Josh |
|
Back to top |
|
|
BlackEdder Advocate
Joined: 26 Apr 2004 Posts: 2588 Location: Dutch enclave in Egham, UK
|
Posted: Mon May 02, 2005 4:01 pm Post subject: |
|
|
Their is the sysreq key. You will have to enable it in the kernel. For more info Code: | less /usr/src/linux/Documentation/sysrq.txt | AFAIK that is the only way to get something like you want to work. All other keybindings will probably need you to at least be logged in. |
|
Back to top |
|
|
vvlly n00b
Joined: 23 Sep 2002 Posts: 52
|
Posted: Mon May 02, 2005 6:51 pm Post subject: |
|
|
I think you could do it with /etc/inittab. As far as I know this will only let you assign one action though. If all you want to do is put the computer to sleep or run some script it should be ok. I have mine setup so Ctrl-Alt-Ins will set windows as the default entry in grub and reboot.
In /etc/inittab
Code: |
kb:12345:kbrequest:COMMAND
|
I also had to setup the keymap for Ctrl-Alt-Ins to send the KeyboardSignal for inittab. I guess you would have to do the same for the "Sleep" button. |
|
Back to top |
|
|
josh Guru
Joined: 05 Feb 2003 Posts: 473 Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo
|
Posted: Tue May 03, 2005 12:16 pm Post subject: |
|
|
Yeah. I found some stuff online and set mine up like this:
Code: | kb::kbrequest:/usr/sbin/hibernate |
and then did
Code: | loadkeys <<eof
>control alt keycode 79 = KeyboardSignal
>control alt keycode 107 = KeyboardSignal
>eof |
But like you said, that will only get one command. I would like to do others because I have enough keys on my keyboard to power down, reboot, sleep, etc. I will look into the kernel magic keys thing that blackedder suggested. Any idea where in the kernel that is exactly? _________________ -Josh |
|
Back to top |
|
|
josh Guru
Joined: 05 Feb 2003 Posts: 473 Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo
|
Posted: Tue May 03, 2005 12:18 pm Post subject: |
|
|
Also. Those extra keys, how do I find their keycodes? _________________ -Josh |
|
Back to top |
|
|
vvlly n00b
Joined: 23 Sep 2002 Posts: 52
|
Posted: Tue May 03, 2005 2:51 pm Post subject: |
|
|
Run showkey from a console. |
|
Back to top |
|
|
|