Discussion:
power button
Aidan Gauland
2011-03-03 02:59:12 UTC
Permalink
Hello,

I like that (by default) pressing the power button causes a clean(ish)
system shutdown, but I don't like how easy it is to hit it by
accident. Is is possible to make it so that I have to hold down the
button for a second (or some duration shorter than the BIOS's
hard-reset push-and-hold duration), so I can't kill all my running
programs and shutdown my system by missing the backspace key or
absentmindedly pushing the power button to unsuspend my machine when
it's already on?

Thanks,
Aidan Gauland
Nevyn
2011-03-03 20:53:53 UTC
Permalink
Post by Aidan Gauland
Hello,
I like that (by default) pressing the power button causes a clean(ish)
system shutdown, but I don't like how easy it is to hit it by
accident.  Is is possible to make it so that I have to hold down the
button for a second (or some duration shorter than the BIOS's
hard-reset push-and-hold duration), so I can't kill all my running
programs and shutdown my system by missing the backspace key or
absentmindedly pushing the power button to unsuspend my machine when
it's already on?
Thanks,
Aidan Gauland
In the good ol' days (using the old system v init system), you could
define what happened when it caught that interrupt. Nowadays it's
probably a little simpler... if you can find where to do it. I'd guess
it would have something to do with kdm/gdm - as what happens there
should be different from what happens at terminal.

Regards,
Nevyn
http://nevsramblings.blogspot.com/

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Shiv Manas
2011-03-03 21:24:31 UTC
Permalink
On Thu, Mar 3, 2011 at 3:59 PM, Aidan Gauland
Post by Aidan Gauland
Hello,
I like that (by default) pressing the power button causes a clean(ish)
system shutdown, but I don't like how easy it is to hit it by
accident.  Is is possible to make it so that I have to hold down the
button for a second (or some duration shorter than the BIOS's
hard-reset push-and-hold duration), so I can't kill all my running
programs and shutdown my system by missing the backspace key or
absentmindedly pushing the power button to unsuspend my machine when
it's already on?
Thanks,
Aidan Gauland
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAk1vA/8ACgkQjyzTRvYJmaWbQgCdGUs3ea/s+JHfxv/+3lAQkIeA
O8wAoINGwuzkXFHA6RNfyYmoVLzYqQV9
=MUHa
-----END PGP SIGNATURE-----
_______________________________________________
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
If you're on GNOME / Ubuntu, goto System -> Preferences -> Power
Management Preferences -> General and choose an appropriate action for
"When the power button is pressed". I've set mine to "Ask Me". This
will popup a box with shutdown/restart/suspend options when you hit
the power button, and will default to 'Shut Down' after 60 seconds.
Other distros should have a similar power management applet with an
option to choose an action upon pressing the power button.

Another alternative is to remap the power button (XF86PowerOff) to
your own command/script: "shutdown -P +1" will wait for one minute
before powering off the machine. You could then map another hotkey to
"shutdown -c" which will abort a shutdown.


Regards,
Shiv

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Bruce Kingsbury
2011-03-03 21:35:24 UTC
Permalink
another good option might be a script that only shuts down if you press the
button twice in some short time.

--
Sent from my Ideos!
Post by Shiv Manas
On Thu, Mar 3, 2011 at 3:59 PM, Aidan Gauland
Post by Aidan Gauland
Hello,
I like that (by default) pressing the power button causes a clean(ish)
system shutdown, but I don't like how easy it is to hit it by
accident. Is is possible to make it so that I have to hold down the
button for a second (or some duration shorter than the BIOS's
hard-reset push-and-hold duration), so I can't kill all my running
programs and shutdown my system by missing the backspace key or
absentmindedly pushing the power button to unsuspend my machine when
it's already on?
Thanks,
Aidan Gauland
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAk1vA/8ACgkQjyzTRvYJmaWbQgCdGUs3ea/s+JHfxv/+3lAQkIeA
O8wAoINGwuzkXFHA6RNfyYmoVLzYqQV9
=MUHa
-----END PGP SIGNATURE-----
_______________________________________________
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
If you're on GNOME / Ubuntu, goto System -> Preferences -> Power
Management Preferences -> General and choose an appropriate action for
"When the power button is pressed". I've set mine to "Ask Me". This
will popup a box with shutdown/restart/suspend options when you hit
the power button, and will default to 'Shut Down' after 60 seconds.
Other distros should have a similar power management applet with an
option to choose an action upon pressing the power button.
Another alternative is to remap the power button (XF86PowerOff) to
your own command/script: "shutdown -P +1" will wait for one minute
before powering off the machine. You could then map another hotkey to
"shutdown -c" which will abort a shutdown.
Regards,
Shiv
_______________________________________________
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Nevyn
2011-03-03 21:36:11 UTC
Permalink
Post by Shiv Manas
If you're on GNOME / Ubuntu, goto System -> Preferences -> Power
Management Preferences -> General and choose an appropriate action for
"When the power button is pressed". I've set mine to "Ask Me". This
will  popup a box with shutdown/restart/suspend options when you hit
the power button, and will default to 'Shut Down' after 60 seconds.
Other distros should have a similar power management applet with an
option to choose an action upon pressing the power button.
Another alternative is to remap the power button (XF86PowerOff) to
your own command/script: "shutdown -P +1"  will wait for one minute
before powering off the machine. You could then map another hotkey to
"shutdown -c" which will abort a shutdown.
Regards,
Shiv
If you do the "shutdown -P +1" approach, you'll probably also want to
display a message - zenity in gnome does quite nicely. Not sure what
the equivalent in KDE is. Otherwise you might not know to hit that
other hotkey...

Regards,
Nevyn
http://nevsramblings.blogspot.com/

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug

Loading...