Make swayidle-lock-screen work with rootful Xwayland
This commit is contained in:
parent
9301bb1bb4
commit
1d973ec606
@ -2,18 +2,32 @@
|
|||||||
|
|
||||||
LOCKFILE="${HOME}/.cache/swayidle-lock-screen.lock"
|
LOCKFILE="${HOME}/.cache/swayidle-lock-screen.lock"
|
||||||
|
|
||||||
|
function has-rootful-xwayland-p {
|
||||||
|
for pid in $(pgrep Xwayland); do
|
||||||
|
local cmdline=(${(0)"$(cat /proc/"${pid}"/cmdline)"})
|
||||||
|
if ! ((${cmdline[(Ie)-rootless]})); then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
function run {
|
function run {
|
||||||
# ensure multiple instances do not run
|
# ensure multiple instances do not run
|
||||||
mkdir -p "$(dirname "${LOCKFILE}")"
|
mkdir -p "$(dirname "${LOCKFILE}")"
|
||||||
exec 4<>"${LOCKFILE}"
|
exec 4<>"${LOCKFILE}"
|
||||||
flock -n 4 || exit 0
|
flock -n 4 || exit 0
|
||||||
dunstctl set-paused true
|
dunstctl set-paused true
|
||||||
swayidle -w -C /dev/null \
|
if has-rootful-xwayland-p; then
|
||||||
timeout 15 "${suspend_command}" resume "${wake_command}" &
|
swaylock ${empty_flag} --color '#000000'
|
||||||
local swayidle_pid="${!}"
|
else
|
||||||
swaylock ${empty_flag} ${img_flags}
|
swayidle -w -C /dev/null \
|
||||||
kill "${swayidle_pid}"
|
timeout 15 "${suspend_command}" resume "${wake_command}" &
|
||||||
eval "${wake_command}"
|
local swayidle_pid="${!}"
|
||||||
|
swaylock ${empty_flag} ${img_flags}
|
||||||
|
kill "${swayidle_pid}"
|
||||||
|
eval "${wake_command}"
|
||||||
|
fi
|
||||||
dunstctl set-paused false
|
dunstctl set-paused false
|
||||||
fix_eww
|
fix_eww
|
||||||
flock -u 4
|
flock -u 4
|
||||||
|
Loading…
Reference in New Issue
Block a user