summaryrefslogtreecommitdiffstats
path: root/linhes/linhes-system/lh_notify-send
blob: dd98edeff640b7e9503254d7b5dd781a7e2f80ae (plain)
1
2
3
4
5
6
7
8
9
10
11
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 "$@"