Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
key binding question.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Mon May 02, 2005 12:28 pm    Post subject: key binding question. Reply with quote

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
View user's profile Send private message
BlackEdder
Advocate
Advocate


Joined: 26 Apr 2004
Posts: 2588
Location: Dutch enclave in Egham, UK

PostPosted: Mon May 02, 2005 12:44 pm    Post subject: Reply with quote

It seems hotkeys doesn't need X to work. Never tested it though: http://techrepublic.com.com/5100-10591-5672373.html?tag=nl.e011
Back to top
View user's profile Send private message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Mon May 02, 2005 1:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Mon May 02, 2005 3:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
BlackEdder
Advocate
Advocate


Joined: 26 Apr 2004
Posts: 2588
Location: Dutch enclave in Egham, UK

PostPosted: Mon May 02, 2005 4:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
vvlly
n00b
n00b


Joined: 23 Sep 2002
Posts: 52

PostPosted: Mon May 02, 2005 6:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Tue May 03, 2005 12:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Tue May 03, 2005 12:18 pm    Post subject: Reply with quote

Also. Those extra keys, how do I find their keycodes?
_________________
-Josh
Back to top
View user's profile Send private message
vvlly
n00b
n00b


Joined: 23 Sep 2002
Posts: 52

PostPosted: Tue May 03, 2005 2:51 pm    Post subject: Reply with quote

Run showkey from a console.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum