Bug#1019244: xdg-utils: xdg-screensaver cannot lock screen with xss-lock
Edgar Yllescas
ed.ylles1997 at gmail.com
Tue Oct 1 18:43:45 BST 2024
Package: xdg-utils
Version: 1.1.3-4.1
Followup-For: Bug #1019244
hi dear maintainer, going back to this here's a more proper patch containing
the commits from the upstream merge request
https://gitlab.freedesktop.org/xdg/xdg-utils/-/merge_requests/118 that altho
green lit has no defined turnaround time for merging nor for the next upstream
release, if you want a squash of the commits in the patch feel free to answer
and i will provide one.
-- Package-specific info:
Desktop environment: XDG_CURRENT_DESKTOP=awesome
-- System Information:
Distributor ID: Devuan
Description: Devuan GNU/Linux 6 (excalibur/ceres)
Release: 6
Codename: excalibur ceres
Architecture: x86_64
Kernel: Linux 6.9.8-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled
xdg-utils depends on no packages.
Versions of packages xdg-utils recommends:
ii libfile-mimeinfo-perl 0.35-1
ii libnet-dbus-perl 1.2.0-2+b2
ii libx11-protocol-perl 0.56-9
ii x11-utils 7.7+6+b1
ii x11-xserver-utils 7.7+10+b1
xdg-utils suggests no packages.
-- no debconf information
-------------- next part --------------
>From 915033b3a0743b5b1adcb3d229037881b80e8f7f Mon Sep 17 00:00:00 2001
From: Teemu Ikonen <tpikonen at gmail.com>
Date: Mon, 26 Nov 2018 12:40:00 +0200
Subject: [PATCH 1/4] adds support for xss-lock
xss-lock runs a user specified locker in response to X server screen saver
events (also some systemd events).
xss-lock would otherwise work fine with the 'screensaver_xserver' code in
current xdg-screensaver, but there is no support for the 'lock' subcommand in
screensaver_xserver, so some power managers (at least xfce4-power-manager) fail
to lock the screen when suspending. Also, the desktop environment detection
code could cause xdg-screensaver to use a code path for some other screen saver
than screensaver_xserver, while xss-lock is running.
This patch detects a running xss-lock program and runs the appropriate actions,
that is, it runs screensaver_xserver and replaces the 'lock' subcommand with
'activate'.
---
scripts/xdg-screensaver.in | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/scripts/xdg-screensaver.in b/scripts/xdg-screensaver.in
index e70942f..db57368 100644
--- a/scripts/xdg-screensaver.in
+++ b/scripts/xdg-screensaver.in
@@ -119,6 +119,14 @@ perform_action()
xautolock_screensaver "$1"
;;
+ xss-lock_screensaver)
+ if [ "$1" = "lock" ]; then
+ screensaver_xserver "activate"
+ else
+ screensaver_xserver "$1"
+ fi
+ ;;
+
xfce)
[ -n "$DISPLAY" ] && screensaver_xserver "$1"
;;
@@ -885,6 +893,8 @@ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.fr
dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.cinnamon.ScreenSaver > /dev/null 2>&1 && DE="cinnamon"
# Consider "xautolock" a separate DE
xautolock -enable > /dev/null 2>&1 && DE="xautolock_screensaver"
+# Consider "xss-lock" a separate DE
+xss-lock --version > /dev/null 2>&1 && ps x -o cmd | grep -q '^xss-lock' && DE="xss-lock_screensaver"
if [ "$action" = "resume" ] ; then
do_resume
--
GitLab
>From 15edd4a1faba35a7378edcff746cf1212e248c54 Mon Sep 17 00:00:00 2001
From: eylles <ed.ylles1997 at gmail.com>
Date: Sun, 14 Jul 2024 22:54:42 -0600
Subject: [PATCH 2/4] force explicit session id in xss-lock
this is the only clean, or as clean as it gets way to detect that xss-lock
is running on the current session, this will force every user of xss-lock to
closely follow the example from /usr/share/doc/xss-lock/xss-lock.service and
explicitly run xss-lock on their system with the -s or --session flag so that
xdg-screensaver can detect the program is running on the current session.
in regards of reliability, if the $XDG_SESSION_ID variable is not present on
the current session that means it was malformed and issues ARE going to EXIST
regardless.
---
scripts/xdg-screensaver.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/xdg-screensaver.in b/scripts/xdg-screensaver.in
index db57368..91b9b69 100644
--- a/scripts/xdg-screensaver.in
+++ b/scripts/xdg-screensaver.in
@@ -894,7 +894,7 @@ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.fr
# Consider "xautolock" a separate DE
xautolock -enable > /dev/null 2>&1 && DE="xautolock_screensaver"
# Consider "xss-lock" a separate DE
-xss-lock --version > /dev/null 2>&1 && ps x -o cmd | grep -q '^xss-lock' && DE="xss-lock_screensaver"
+xss-lock --version > /dev/null 2>&1 && ps x -o cmd | grep '^xss-lock' | grep -q "\-s ${XDG_SESSION_ID}\|--session=${XDG_SESSION_ID}" && DE="xss-lock_screensaver"
if [ "$action" = "resume" ] ; then
do_resume
--
GitLab
>From 9b5f8366120f7bd93a6b4637e69c2f295f828228 Mon Sep 17 00:00:00 2001
From: eylles <ed.ylles1997 at gmail.com>
Date: Fri, 30 Aug 2024 18:46:15 -0600
Subject: [PATCH 3/4] avoid an unnecessary binary execution
---
scripts/xdg-screensaver.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/xdg-screensaver.in b/scripts/xdg-screensaver.in
index 91b9b69..b890d4c 100644
--- a/scripts/xdg-screensaver.in
+++ b/scripts/xdg-screensaver.in
@@ -894,7 +894,7 @@ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.fr
# Consider "xautolock" a separate DE
xautolock -enable > /dev/null 2>&1 && DE="xautolock_screensaver"
# Consider "xss-lock" a separate DE
-xss-lock --version > /dev/null 2>&1 && ps x -o cmd | grep '^xss-lock' | grep -q "\-s ${XDG_SESSION_ID}\|--session=${XDG_SESSION_ID}" && DE="xss-lock_screensaver"
+command -v xss-lock > /dev/null 2>&1 && ps x -o cmd | grep '^xss-lock' | grep -q "\-s ${XDG_SESSION_ID}\|--session=${XDG_SESSION_ID}" && DE="xss-lock_screensaver"
if [ "$action" = "resume" ] ; then
do_resume
--
GitLab
>From 78c203cf6bc554ed693379978cd0d34ea0896065 Mon Sep 17 00:00:00 2001
From: eylles <ed.ylles1997 at gmail.com>
Date: Sat, 31 Aug 2024 03:07:22 -0600
Subject: [PATCH 4/4] Use multiple patterns as fixed strings
Avoid turning the variable XDG_SESSION_ID into a regex when it is not intended
to be a regex by using the -F flag.
Use the -e flag to specify the two possible patterns that will be searched and
interpreted as fixed strings.
POSIX grep spec:
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/grep.html
---
scripts/xdg-screensaver.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/xdg-screensaver.in b/scripts/xdg-screensaver.in
index b890d4c..a9ddc51 100644
--- a/scripts/xdg-screensaver.in
+++ b/scripts/xdg-screensaver.in
@@ -894,7 +894,7 @@ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.fr
# Consider "xautolock" a separate DE
xautolock -enable > /dev/null 2>&1 && DE="xautolock_screensaver"
# Consider "xss-lock" a separate DE
-command -v xss-lock > /dev/null 2>&1 && ps x -o cmd | grep '^xss-lock' | grep -q "\-s ${XDG_SESSION_ID}\|--session=${XDG_SESSION_ID}" && DE="xss-lock_screensaver"
+command -v xss-lock > /dev/null 2>&1 && ps x -o cmd | grep '^xss-lock' | grep -qF -e "-s ${XDG_SESSION_ID}" -e "--session=${XDG_SESSION_ID}" && DE="xss-lock_screensaver"
if [ "$action" = "resume" ] ; then
do_resume
--
GitLab
More information about the Pkg-freedesktop-maintainers
mailing list