summaryrefslogtreecommitdiffstats
path: root/linhes/linhes-system/lh_notify-send
diff options
context:
space:
mode:
Diffstat (limited to 'linhes/linhes-system/lh_notify-send')
-rwxr-xr-xlinhes/linhes-system/lh_notify-send12
1 files changed, 12 insertions, 0 deletions
diff --git a/linhes/linhes-system/lh_notify-send b/linhes/linhes-system/lh_notify-send
new file mode 100755
index 0000000..dd98ede
--- /dev/null
+++ b/linhes/linhes-system/lh_notify-send
@@ -0,0 +1,12 @@
+#!/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 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 "$@"