diff options
Diffstat (limited to 'linhes/linhes-system/lh_notify-send')
-rwxr-xr-x | linhes/linhes-system/lh_notify-send | 19 |
1 files changed, 19 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..0a11de8 --- /dev/null +++ b/linhes/linhes-system/lh_notify-send @@ -0,0 +1,19 @@ +#!/bin/bash + +#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 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@" |