summaryrefslogtreecommitdiffstats
path: root/linhes/linhes-system/lh_notify-send
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2025-01-01 06:46:17 (GMT)
committerBritney Fransen <brfransen@gmail.com>2025-01-01 06:46:17 (GMT)
commit2f9cd04b34011c520ae42ff5b665dff2c6392d90 (patch)
treef851ca5208b8eb49d1bf50fdf90ae5f1a6566a7e /linhes/linhes-system/lh_notify-send
parent4a9193accb504077337e73b8182f789cc6e3b20b (diff)
downloadlinhes_pkgbuild-2f9cd04b34011c520ae42ff5b665dff2c6392d90.zip
linhes_pkgbuild-2f9cd04b34011c520ae42ff5b665dff2c6392d90.tar.gz
linhes_pkgbuild-2f9cd04b34011c520ae42ff5b665dff2c6392d90.tar.bz2
linhes-system: lh_notify-send: change method to determing the display number
lh_apply_UI_settings.sh: change all cmds to use kwriteconfig6
Diffstat (limited to 'linhes/linhes-system/lh_notify-send')
-rwxr-xr-xlinhes/linhes-system/lh_notify-send19
1 files changed, 13 insertions, 6 deletions
diff --git a/linhes/linhes-system/lh_notify-send b/linhes/linhes-system/lh_notify-send
index dd98ede..0a11de8 100755
--- a/linhes/linhes-system/lh_notify-send
+++ b/linhes/linhes-system/lh_notify-send
@@ -1,12 +1,19 @@
#!/bin/bash
-#Detect the name of the display in use
-display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
-
-#Detect the user using such display
-user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
+#Detect the name of the display in use from 0 to 10
+for i in {0..10};
+do
+ #Detect the user using such display
+ user=$(who | grep "(:${i})" | awk '{print $1}' | head -n 1)
+ if [[ ! -z "$user" ]];
+ then
+ display="DISPLAY=:${i}"
+ break
+ fi
+done
#Detect the id of the user
uid=$(id -u $user)
-sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@"
+
+sudo -u $user $display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@"