Pinebook Pro (i3 WM): Confirm Shutdown on Power Button
#4
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'


Messages In This Thread
RE: Pinebook Pro (i3 WM): Confirm Shutdown on Power Button - by loblik - 08-14-2020, 06:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Stock Debian on original Pinebook moonwalkers 0 188 07-02-2021, 12:18 PM
Last Post: moonwalkers
  E: The repository 'http://pinebook.kde.org.uk bionic Release' no longer has a Release pixelpaperyarn 3 991 05-07-2021, 10:20 AM
Last Post: tophneal
  Slarm64 on Pinebook [Slackware Arm - 64 bit] KRT 29 14,916 05-04-2021, 11:34 PM
Last Post: mara
  DietPi OS for Pinebook MichaIng 1 1,030 03-10-2021, 02:45 PM
Last Post: MichaIng
  pinebook.kde.org.uk no longer has release file?? supermassive 1 974 01-20-2021, 11:18 AM
Last Post: tophneal
Question Ran apt update on my Pinebook.. ford442 0 799 12-25-2020, 04:40 PM
Last Post: ford442
Information Manjaro ARM for Pinebook erchache2000 88 44,031 11-29-2020, 04:36 PM
Last Post: Mr.Fermer
  Pinebook is going the way of Betamax? trigger 10 6,314 11-01-2020, 02:02 PM
Last Post: leperotero
  Manjaro sway profile for pinebook e-minguez 3 2,373 07-21-2020, 03:25 PM
Last Post: jezek
  Reset User or Factory Reset PineBook Linux 11.6" pittman64 1 2,451 07-07-2020, 11:26 PM
Last Post: tllim

Forum Jump:


Users browsing this thread: 1 Guest(s)