PINE64
Pinebook Pro (i3 WM): Confirm Shutdown on Power Button - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook (https://forum.pine64.org/forumdisplay.php?fid=76)
+--- Forum: Linux on Pinebook (https://forum.pine64.org/forumdisplay.php?fid=79)
+--- Thread: Pinebook Pro (i3 WM): Confirm Shutdown on Power Button (/showthread.php?tid=10099)



Pinebook Pro (i3 WM): Confirm Shutdown on Power Button - etothepii - 06-06-2020

I recently purchased the Pine Book Pro, and for the most part, I've really been enjoying it. However, I was wondering if there's a way to customize the behavior when the power button is pressed.

I'm running Manjaro (the i3 WM variant), and when the power button is pressed, it immediately shuts the system down. While this would normally be fine, the power button is unfortunately where the delete key is on my other machines, so I've hit it by mistake more than once.

Is there a way to configure the power button such that, when pressed, there's some confirmation, instead of an immediate power down?

Thank you for any help in this matter.


RE: Pinebook Pro (i3 WM): Confirm Shutdown on Power Button - jezek - 06-07-2020

I'm sorry, but I have to tell you, you are on wrong forum. This is the pinebook (the ancestor of pinebook pro) forum.

Try your question here: https://forum.pine64.org/forumdisplay.php?fid=111


RE: Pinebook Pro (i3 WM): Confirm Shutdown on Power Button - xmixahlx - 06-07-2020

assuming a mod moves this...

disable the power button in systemd, then map the button in your i3 config.

i use wlogout on sway mapped to bindsym + shift + e inetead of the default and my power button does nothing. i keep pushing it by mistake...


RE: Pinebook Pro (i3 WM): Confirm Shutdown on Power Button - loblik - 08-14-2020

This is how I solved this in sway (wayland). I wanted power button to open be/dmenu with common actions (lock, suspend...).

1. Disable power button handling in logind.

/etc/systemd/logind.conf:
Code:
HandlePowerKey=ignore

2. Handle power button in sway.

~/.sway/config:
Code:
input "gpio-key-power" xkb_model "pc105"

bindsym XF86PowerOff exec seat

3. Add seat script to your path.

seat:
Code:
#!/bin/bash

cmd=`echo -e "lock\nlogout\nsuspend\npoweroff" | bemenu -l 10 -p 'seat>'`

case "$cmd" in

    lock)

        loginctl lock-session 

    ;;

    logout)

        loginctl terminate-session $XDG_SESSION_ID

    ;;

    suspend)

        systemctl suspend

    ;;

    poweroff)

        systemctl poweroff

    ;;

esac

5. For loginctl lock-session to work, you also need something like this (mainly the lock part).

~/.sway/config
Code:
exec swayidle -w \
          timeout 300 'swaylock -f -c 000000' \
          timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
          before-sleep 'swaylock -f -c 000000' \
          lock 'swaylock -f -c 000000'