Port 4.0i586 - Info window instead of immediately Shutdown when pressing On/Off?

Technical issues/questions of an intermediate or advanced nature.
User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Port 4.0i586 - Info window instead of immediately Shutdown when pressing On/Off?

Post#1 by Rava » 16 Sep 2022, 14:36

System Porteus 4.0 i586 XFCE 4.12

What must be changed so that when pressing the "On/Off" button at a notebook, instead of immediately shutting down displaying a confirmation if Shutdown should be indeed executed after a certain wait time or be cancelled.
The length of that message should be definably, e.g. 30 seconds or 60 seconds - when nothing is done by the user the shutdown should happen.

The reason why I want this is that I just now accidental shut down the machine. I was of the impression it was in suspend mode, and with that machine pressing any key of the keyboard doesn't make it return from suspend, you have to press the "on/off" button instead.
And since I shield the bright status icons (battery / AC adapter plugged in / sleep/suspend/on / harddisc writing) and the display was switched off I did not realize the machine was on with switched off display instead of being in suspend. Until the display switched on only to display me the shutdown procedure.
ImageImage
Cheers!
Yours Rava

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3933
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

Port 4.0i586 - Info window instead of immediately Shutdown when pressing On/Off?

Post#2 by ncmprhnsbl » 17 Sep 2022, 03:34

hmmm, maybe.. very edge-casey area here..

take a look at: /etc/acpi/powerbtn:

Code: Select all

# /etc/acpi/events/power
# This is called when the user presses the power button
event=button/power (PWR.||PBTN)
action=/sbin/poweroff
i guess you want:

Code: Select all

action=/path/to/some/script_that_asks_me_if_i_really_want_to_shutdown_and_does_so_if_i_don't_respond_after_n_seconds
..could be an issue if the reason to use the power button is because of some major system fubar and running said script is impossible..(but /sbin/poweroff might just still work)
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Port 4.0i586 - Info window instead of immediately Shutdown when pressing On/Off?

Post#3 by Rava » 17 Sep 2022, 06:37

ncmprhnsbl wrote:
17 Sep 2022, 03:34
..could be an issue if the reason to use the power button is because of some major system fubar and running said script is impossible..(but /sbin/poweroff might just still work)
You are correct on that but if it were the case, then it would be my fault for messing with the system. (Or any user that read this thread and did tweak his system as well)

Also, when /sbin/poweroff might just still work - REISUB should also still work, yes?

Added in 11 hours 8 minutes 8 seconds:
I forgot to ask, if I do the changes in /etc/acpi/powerbtn

Code: Select all

action=/usr/local/bin/ask-shutdown-script
do I have to reboot first or do the change work immediately without reboot?

(To make it permanent I will have to put the /usr/local/bin/ask-shutdown-script and the changed /etc/acpi/powerbtn into my rootcopy/)
Cheers!
Yours Rava

Post Reply