Provide a unified screen locking mechanism, supporting x11 and sway. Auto locking is also improved to correctly disable inputs in all screen locking scenarios, and re-enabling them on unlock. Unlock on keypad slide now also works on sway (from sway v1.12). Any x11 UI can use the existing script by setting up appropriate keybinds to the script and autostarting xautolock. It may be necessary to disable any built-in autolock method integrated within a specific x11 WM. NB: This is NOT locking in the sense of secure locking. It is purely for turning the screen off and disabling some inputs (currently only the touchscreen) to prevent unintended wakeups. Signed-off-By: Sicelo A. Mhlongo <absicsz@gmail.com> Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8472>
61 lines
1.1 KiB
Bash
61 lines
1.1 KiB
Bash
#!/bin/ash
|
|
|
|
user=$( getent passwd 10000 | cut -d: -f1 )
|
|
cmd=$( echo $0 | awk '{i=split($0,a,"/"); print a[i]}' )
|
|
|
|
case $cmd in
|
|
KP_SLIDE_OPEN)
|
|
su $user -c '/usr/bin/screenlock.sh unlock'
|
|
/usr/bin/screenlock.sh kbd_backlight 31
|
|
;;
|
|
KP_SLIDE_CLOSE)
|
|
/usr/bin/screenlock.sh kbd_backlight 0
|
|
;;
|
|
CAM_BTN_DWN)
|
|
echo "Not implemented yet"
|
|
;;
|
|
CAM_BTN_UP)
|
|
echo "Not implemented yet"
|
|
;;
|
|
CAM_FOCUS_DWN)
|
|
echo "Not implemented yet"
|
|
;;
|
|
CAM_FOCUS_UP)
|
|
echo "Not implemented yet"
|
|
;;
|
|
CAM_LID_CLOSE)
|
|
echo "Not implemented yet"
|
|
;;
|
|
CAM_LID_OPEN)
|
|
echo "Not implemented yet"
|
|
;;
|
|
SCRNLCK_DWN)
|
|
echo "Not implemented yet"
|
|
;;
|
|
SCRNLCK_UP)
|
|
echo "Not implemented yet"
|
|
;;
|
|
HEADPHONE_INSERT)
|
|
alsactl restore -f /var/lib/alsa/asound.state.headset
|
|
;;
|
|
HEADPHONE_REMOVE)
|
|
alsactl restore -f /var/lib/alsa/asound.state.speakers
|
|
;;
|
|
MICROPHONE_INSERT)
|
|
echo "Not implemented yet"
|
|
;;
|
|
MICROPHONE_REMOVE)
|
|
echo "Not implemented yet"
|
|
;;
|
|
VIDEOOUT_INSERT)
|
|
echo "Not implemented yet"
|
|
;;
|
|
VIDEOOUT_REMOVE)
|
|
echo "Not implemented yet"
|
|
;;
|
|
*)
|
|
echo "Unknown event"
|
|
exit 1
|
|
;;
|
|
esac
|