Support for a fork of i3lock called i38lock added. In stormus, install i38lock. To build from source, https://git.stormux.org/storm/i38lock This is more secure than the pin implementation but it remains available.
This commit is contained in:
@@ -16,6 +16,11 @@ scriptDir="${scriptPath%/*}"
|
||||
runtimeDir="${XDG_RUNTIME_DIR:-/tmp}"
|
||||
lockDir="${runtimeDir}/i38-screenlock-autolock"
|
||||
pollSeconds=5
|
||||
lockCommand=("${@:2}")
|
||||
|
||||
if [[ ${#lockCommand[@]} -eq 0 ]]; then
|
||||
lockCommand=("${scriptDir}/screenlock.sh")
|
||||
fi
|
||||
|
||||
notify_autolock_disabled() {
|
||||
local message="$1"
|
||||
@@ -56,7 +61,14 @@ focused_window_is_fullscreen() {
|
||||
}
|
||||
|
||||
screenlock_is_running() {
|
||||
pgrep -f "${scriptDir}/screenlock.sh" &> /dev/null
|
||||
case "${lockCommand[0]##*/}" in
|
||||
i38lock)
|
||||
pgrep -x i38lock &> /dev/null
|
||||
;;
|
||||
*)
|
||||
pgrep -f "${lockCommand[0]}" &> /dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
@@ -103,7 +115,7 @@ while : ; do
|
||||
idleMilliseconds="$(xprintidle 2> /dev/null || echo 0)"
|
||||
if [[ "$idleMilliseconds" =~ ^[0-9]+$ ]] && [[ "$idleMilliseconds" -ge $((autolockSeconds * 1000)) ]]; then
|
||||
if ! screenlock_is_running && ! video_is_playing && ! focused_window_is_fullscreen; then
|
||||
"${scriptDir}/screenlock.sh"
|
||||
"${lockCommand[@]}"
|
||||
sleep "$pollSeconds"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user