commit 10a89e5d9d74ef7261eaedf5f3ed0923440a180f parent c534fa16154ca77e66ef468189362456f995872d Author: tongong <tongong@gmx.net> Date: Sun, 11 Jul 2021 22:36:54 +0200 added xss-lock Diffstat:
M | dwm/autostart.sh | | | 2 | ++ |
A | dwm/transfer-sleep-slock.sh | | | 50 | ++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/dwm/autostart.sh b/dwm/autostart.sh @@ -10,6 +10,8 @@ else # window manager settings picom & nitrogen --restore & + # run slock on standby and suspend + xss-lock -l ~/.dwm/transfer-sleep-slock.sh & # dwm statusbar statnot ~/.dwm/statnot/statnot-config.py & diff --git a/dwm/transfer-sleep-slock.sh b/dwm/transfer-sleep-slock.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# script for xss-lock + +# Example locker script -- demonstrates how to use the --transfer-sleep-lock +# option with a fixed delay to give simple lockers a little bit of time to lock +# the screen before the system goes the sleep. + +## CONFIGURATION ############################################################## + +# Command to start the locker (should not fork) +locker="slock" + +# Delay in seconds. Note that by default systemd-logind allows a maximum sleep +# delay of 5 seconds. +sleep_delay=1 + +# Run before starting the locker +pre_lock() { + #mpc pause + return +} + +# Run after the locker exits +post_lock() { + return +} + +############################################################################### + +pre_lock + +# kill locker if we get killed +trap 'kill %%' TERM INT + +if [[ -e /dev/fd/${XSS_SLEEP_LOCK_FD:--1} ]]; then + # lock fd is open, make sure the locker does not inherit a copy + $locker {XSS_SLEEP_LOCK_FD}<&- & + + sleep $sleep_delay + + # now close our fd (only remaining copy) to indicate we're ready to sleep + exec {XSS_SLEEP_LOCK_FD}<&- +else + $locker & +fi + +wait # for locker to exit + +post_lock