You are not logged in.
Hello there.
I hide my box in a cupboard (!)
I've got an external power switch to bring it to life.
But I need to open the cupboard and push my computer power button to switch it off.
Is there a way to set up a system-wide keyboard shortcut? I'd like to power off my computer when I hit, say, Ctrl+Alt+End.
Thanks.
Last edited by brazzmonkey (2009-05-22 18:11:44)
what goes up must come down
Offline
for instance
gnome-terminal -x poweroff
with gnome terminal
urxvt -e poweroff
with urxvt
...
you can create a shortcut or a hot key.
Last edited by hcjl (2009-05-22 12:25:17)
Offline
Thanks, but that's not exactely what I'm looking for...
First of all, I use LXDE on this machine. But I want to set up a hot key in a way that is not LXDE (or any other DE) related. I want it to work in console mode as well, and, if possible, not rely on a specific program. That's what I meant by system-wide.
what goes up must come down
Offline
Thanks, but that's not exactely what I'm looking for...
First of all, I use LXDE on this machine. But I want to set up a hot key in a way that is not LXDE (or any other DE) related. I want it to work in console mode as well, and, if possible, not rely on a specific program. That's what I meant by system-wide.
Put this in your sudoers:
your_username ALL=(ALL) NOPASSWD: /sbin/shutdown -h now
Then just make a shortcut for "sudo shutdown -h now". The NOPASSWD: is the important part here.
Check out /etc/inittab. There is a shortcut defined for alt+ctrl+del (it reboots the system, you can change that so it shuts down, perhaps you can add your alt+ctrl+home keybind there but I'm not sure, haven't fiddled with it)
Last edited by moljac024 (2009-05-22 19:41:24)
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
Hi!
I saw reset/strg+alt+rm being set in some config file I browsed not long ago (I think I was fooling around with "sudo cat $(sudo find /etc -type f -readable) | grep stuff") and somewhere I read something about how to disable that in a very old xorg.conf. It don't recall where, don't know if one can put those things together (setting shortcut for shutdown + disable xorg disabling the shurtcut) but maybe that reminds someone of something useful
good luck!
Offline
Check this out: http://wiki.archlinux.org/index.php/Ext … in_Console
I believe you will have to define the key combinations in X as well.
I'll throw in this as well: http://linuxgazette.net/issue55/henderson.html
Last edited by Ashren (2009-05-22 19:46:19)
Offline
@moljac024
I know I can set Ctrl+Alt+Del to shutdown in inittab, but that's not the point, because I'd like to keep for reboots. I hoped I could find a way to add other combinations and actions, but so far I haven't found anything relevant.
@Ashren
I think we're getting closer here. Stille have to investigate a bit, I guess.
what goes up must come down
Offline
I still haven't found a proper way to set a keyboard shortcut. I need it to work with no user being logged on the machine.
Any guidance would be appreciated.
Thanks.
what goes up must come down
Offline
You can use xbindkeys to set a shortcut for X. X controls the keyboard while it runs, so a console keyboard definition like in Ashren's post won't work under X.
As to the console, Ashren's links look promising?? Did it not work?
Offline
How about "extending" the computer power button to the outside?
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
How about "extending" the computer power button to the outside?
Don't extend it, leave it there and then wire a second power button in parralell with the existing one.
Offline
I use actkbd (it is in aur) with it you can have a system-wide keyboard shortcut
Last edited by kazuo (2009-06-19 21:27:22)
Offline
I'm a bit concerned about allowing shutdown in my /etc/sudoers. My PC is also a server so it can be a security flaw.
About Readline, it's such a pain for me... I understood I would have to add something like this:
C-M-[End key here]: "/sbin/shutdown -h now"
in /etc/inputrc.
But I don't know what I should write to specify the "End" key.
In X, I did not achieved a success either. I set
"sudo /sbin/shutdown -h now"
Control+Alt+Mod2 + End
in .xbindkeysrc and added xbindkeys to my ~/.xinitrc. Doesn't work.
Last edited by brazzmonkey (2009-06-19 22:46:20)
what goes up must come down
Offline
For readline, try:
"\C-\M-\x6B": /sbin/halt
Make sure you keep the quotes. This is the "keyseq": function-name format shown in man readline. I'm not sure if hex 6B is the right code for the End key, I got the keycode from http://www.comptechdoc.org/os/linux/how … codes.html and converted it to hex.
You could also try:
"\C-\M-\e[4~": /sbin/halt
Reference: http://www.comptechdoc.org/os/linux/how … progs.html
Offline