Garuda energy-safer-mode scripts example?

I wanted to know if someone could provide scripts or script-examples that get executed when the power-button gets pressed (as found in the system energy-safer mode in settings)?

Since I found nothing online I wanted to ask here and create a new topic, if it's unfitting just delete this post.

(garuda-inxi is not needed here I guess since it's a universal question, if I'm wrong correct me).

What specifically do you want to happen when the power button is pressed?

If the desired event is any of these: poweroff, reboot, halt, suspend, hibernate, hybrid-sleep, suspend-then-hibernate, lock, or kexec, then no script is needed--you can simply uncomment the HandlePowerKey line in /etc/systemd/logind.conf (or add a drop-in config in /etc/systemd/logind.conf.d/) and specify the desired event like so:


You can read more about this here: Power management - ArchWiki, or here: logind.conf(5) — Arch manual pages.


Yeah that's the question I had forgot to add: Which scripts would make sense? And/Or which scripts does the community use? (If they even use a script for the power-button) - I had no idea which script would make sense so I thought I'd ask the community :slightly_smiling_face:

For any common use of the power button, I do not think using a script makes sense.

A script would be needed if you wanted your power button to do something the power button is not typically used for, like launch an application or something. For the options that can be found in the power management settings, a script is unnecessary–you can simply make an edit to /etc/systemd/logind.conf like I mentioned above.

1 Like

Ok, thanks a lot for the answer - marked it as solved now :smiley_cat:

If you want to add a script after all, I have recently done the same to my Pinephone Pro after switching to hyprland.

1 Like

Ah, interesting, I see how it works or can be used now :slight_smile: If you want we can chat, was thinking of buying the pinephone instead of my current iPhone

if you already have an Iphone, better not replace it (for now). This linux on mobile thing is still very much in beta and you really need to get used to the problems that arise.

Oh ok, well I played with the thought of buying it but I heard exactly what you said from anybody else and I don't want to crash a device and then lose my two-factor-authenticator with it - I have my complaints about apple and their privacy but at least the iPhone is really stable and secure and that's what I need my phone for :slight_smile:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.