LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-21-2011, 12:53 PM   #1
phys
Member
 
Registered: Jun 2006
Location: Istanbul, Turkey
Distribution: Slackware
Posts: 90

Rep: Reputation: 23
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...

Last edited by phys; 05-21-2011 at 12:54 PM. Reason: Box
 
Old 05-21-2011, 01:09 PM   #2
rigelan
Member
 
Registered: Jul 2005
Location: Iowa
Distribution: Slackware
Posts: 180

Rep: Reputation: 19
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.

Last edited by rigelan; 05-21-2011 at 01:11 PM.
 
Old 05-21-2011, 01:11 PM   #3
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 8,751

Rep: Reputation: Disabled
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'.
 
Old 05-21-2011, 01:48 PM   #4
phys
Member
 
Registered: Jun 2006
Location: Istanbul, Turkey
Distribution: Slackware
Posts: 90

Original Poster
Rep: Reputation: 23
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.

Last edited by phys; 05-22-2011 at 02:33 PM.
 
Old 05-21-2011, 02:11 PM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
@phys

Is this a laptop?
 
Old 05-21-2011, 02:22 PM   #6
phys
Member
 
Registered: Jun 2006
Location: Istanbul, Turkey
Distribution: Slackware
Posts: 90

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by MTK358 View Post
@phys

Is this a laptop?
No, it is a desktop computer.
 
Old 05-22-2011, 10:23 PM   #7
rigelan
Member
 
Registered: Jul 2005
Location: Iowa
Distribution: Slackware
Posts: 180

Rep: Reputation: 19
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.
 
Old 05-24-2011, 01:59 AM   #8
jimtrenton
Member
 
Registered: Oct 2007
Distribution: Slackware 14.0, 14.1
Posts: 36

Rep: Reputation: 6
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.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard Power Button to shutdown my computer stringZ Linux - Software 8 10-16-2009 05:23 AM
ACPI power off works with PS/2 keyboard but not with USB keyboard mrwaters Linux - Hardware 5 10-05-2006 05:06 PM
how should i enable the middle button of 3-button mouse ?? b0nd Slackware 1 07-17-2006 02:46 AM
Needs to push power button to power off? danpin Linux - Newbie 5 10-21-2003 08:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration