Просмотр исходного кода

mailsync/notify-send: provide a default `$DISPLAY`

A user reports notifications not working on their setup because there is
no display id  contained in the `ps`/`pgrep` output  concerning the Xorg
process.

This commit checks if there's a display server running at all, and if so
it sends notifications even if there's no display id.

Resolves https://github.com/LukeSmithxyz/mutt-wizard/issues/661
tags/v3.3
Kr1ss 3 лет назад
Родитель
Сommit
747af1cccb
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 23F078862ACFE50
1 измененных файлов: 5 добавлений и 3 удалений
  1. +5
    -3
      bin/mailsync

+ 5
- 3
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 ;}


Загрузка…
Отмена
Сохранить