Advertisement
doc_gonzo

notiufy x-display 0

Apr 13th, 2021
856
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | None | 0 0
  1. #!/bin/bash
  2. PATH=/usr/bin:/bin
  3.  
  4. XUSERS=($(who|grep -E "\(:[0-9](\.[0-9])*\)"|awk '{print $1$NF}'|sort -u))
  5. for XUSER in "${XUSERS[@]}"; do
  6.     NAME=(${XUSER/(/ })
  7.     DISPLAY=${NAME[1]/)/}
  8.     DBUS_ADDRESS=unix:path=/run/user/$(id -u ${NAME[0]})/bus
  9.     sudo -u ${NAME[0]} DISPLAY=${DISPLAY} \
  10.                        DBUS_SESSION_BUS_ADDRESS=${DBUS_ADDRESS} \
  11.                        PATH=${PATH} \
  12.                        notify-send "$@"
  13. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement