LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to enable keyboard power button? (https://www.linuxquestions.org/questions/slackware-14/how-to-enable-keyboard-power-button-881975/)

phys 05-21-2011 12:53 PM

How to enable keyboard power button?
 
Hi folks :)

Is it possible to turn off the computer (Slackware 13.37 Box) simply using the power button on the keyboard?

Thanks...

rigelan 05-21-2011 01:09 PM

You can program any button to do any task in linux/Bash/KDE/whatever. Its called key-bindings. I use alt-control-delete to bring up a password protected xscreensaver.

My keyboard doesn't have a power button, but I'm sure your power button has some identifier that lets it communicate with the system.

Didier Spaier 05-21-2011 01:11 PM

Hi Phys,

It is possible on some laptops through ACPI.

Among other things it depends on your hardware and the way ACPI is configured.

It works here (Lenovo Thinkpad T61).

Please provide the brand / model of your computer, and outputs of 'dmesg|grep Power' and 'lsmod|grep acpi'.

phys 05-21-2011 01:48 PM

Thank you Rigelan and Didier Spaier.

Quote:

...
You can program any button to do any task in linux/Bash/KDE/whatever. Its called key-bindings. I use alt-control-delete to bring up a password protected xscreensaver.
...
I am going to try your method Rigelan.

Quote:

...
It is possible on some laptops through ACPI.

Among other things it depends on your hardware and the way ACPI is configured.

It works here (Lenovo Thinkpad T61).
...
In fact, I was asked by my friend, who freshly installed Slackware on his desktop computer, about whether keyboard power button works on Slackware 13.37 as in Ubuntu 11.04 or not. His desktop computer's main board is VGA Integrated Intel DG965WH Desktop Board for Core2 Duo Processors. He uses Logitech's PS2 media keyboard with power button on the upper right corner. He said that his desktop computer's keyboard power button was functioning with Ubuntu 11.04. Is there a configuration file like "xorg.conf" to add parameters for keyboard power button on Slackware?

Again thanks for your deal.

MTK358 05-21-2011 02:11 PM

@phys

Is this a laptop?

phys 05-21-2011 02:22 PM

Quote:

Originally Posted by MTK358 (Post 4363090)
@phys

Is this a laptop?

No, it is a desktop computer.

rigelan 05-22-2011 10:23 PM

How far have you gotten in figuring this problem out yet?

I know that you would need to figure out what keycode is produced when the power button is pressed.

Then you need to put that keycode into your keybindings file (each file is different if you do keybindings for bash / KDE / XFCE / Fluxbox)

You need to connect that keybinding with an appropriate command, such as Logout, init 0 (shutdown), suspend-to-ram (sleep), or suspend-to-disk.

jimtrenton 05-24-2011 01:59 AM

Hi

This command should help you obtain the keycode for that particular button on the keyboard
Quote:

xev(1)
.
Run it in the terminal, push the key and you should have all the info needed to bind the key to the action that you need.


All times are GMT -5. The time now is 12:14 PM.