diff options
author | Luke Smith <luke@lukesmith.xyz> | 2021-02-25 12:21:35 -0500 |
---|---|---|
committer | Luke Smith <luke@lukesmith.xyz> | 2021-02-25 12:21:35 -0500 |
commit | bf9aa99930503c0c686dc27414877cf4affe5e50 (patch) | |
tree | 28fe25eb2115bf808260b5f77cba659d6fdc5999 /bin | |
parent | 4b30e06d05cd6112de84dafb7aa3c2a81b416e88 (diff) | |
parent | 747af1cccbfbb99fae3661c49b5ad2ccf3d3c493 (diff) |
Merge branch 'fix-661' of https://github.com/Kr1ss-XD/mutt-wizard into Kr1ss-XD-fix-661
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/mailsync | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/mailsync b/bin/mailsync index 6741804..ba0a4b5 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -39,12 +39,14 @@ case "$(uname)" in messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) - displays="$(pgrep -a X\(org\|wayland\) | grep -wo "[0-9]*:[0-9]\+" | sort -u)" - notify() { for x in $displays; do + # remember if a display server is running since `ps` doesn't always contain a display + pgrepoutput="$(pgrep -a X\(org\|wayland\))" + displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" + notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do export DISPLAY=$x notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." done ;} - messageinfo() { for x in $displays; do + messageinfo() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do export DISPLAY=$x notify-send --app-name="mutt-wizard" "📧$from:" "$subject" done ;} |