summaryrefslogtreecommitdiffstats
path: root/linhes/linhes-system/lh_notify-send
blob: 0a11de84e4df818436a5db1f745eec9251b716d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 "$@"