diff options
author | Junicchi <24779257+KebabLord@users.noreply.github.com> | 2023-01-12 08:08:16 +0300 |
---|---|---|
committer | Junicchi <24779257+KebabLord@users.noreply.github.com> | 2023-01-12 08:08:16 +0300 |
commit | bfa70c52422d9043bb472ec154d7212683ac6eab (patch) | |
tree | 69f5080966e6118f167a9ebd44e567cbf651fe55 | |
parent | bb4b11de7942bc358958b714888dc96b9add90ca (diff) |
read xorg displays from unix-domain socket if pgrep returns null
-rwxr-xr-x | bin/mailsync | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/mailsync b/bin/mailsync index 26e71ea..d2394f9 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -43,6 +43,8 @@ case "$(uname)" in # remember if a display server is running since `ps` doesn't always contain a display pgrepoutput="$(pgrep -ax X\(\|org\|wayland\))" displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" + [ -z $displays ] && [ -d /tmp/.X11-unix ] && displays=$(cd /tmp/.X11-unix && for x in X*; do echo ":${x#X}"; done) + notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do export DISPLAY=$x notify-send --app-name="mutt-wizard" "New mail!" "📬 $2 new mail(s) in \`$1\` account." |