Skip to content

Commit

Permalink
Adjusted the log monitor target for recent versions of YAD.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlesage committed Jun 29, 2020
1 parent 714b30d commit 3b217e6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rootfs/etc/logmonitor/targets.d/yad/send
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.

TITLE="$1"
MSG="$2"
MSG="$(echo "$2" | fold -w 80 -s)"
LEVEL="$3"

YAD="$(which yad)"
Expand All @@ -15,6 +15,12 @@ if [ "${YAD:-UNSET}" != "UNSET" ]; then
export XDG_CONFIG_HOME="$XDG_BASE/xdg/config"
export XDG_CACHE_HOME="$XDG_BASE/xdg/cache"

if [ "$(yad --version | cut -d'.' -f1)" = "0" ]; then
BUTTON_NAME="gtk-ok"
else
BUTTON_NAME="yad-ok"
fi

yad \
--fixed \
--center \
Expand All @@ -26,7 +32,7 @@ if [ "${YAD:-UNSET}" != "UNSET" ]; then
--text "<b>$TITLE</b>" \
--form \
--field "$MSG:LBL" \
--button=gtk-ok:0 > /dev/null || true
--button=$BUTTON_NAME:0 > /dev/null || true

rm -r "$XDG_BASE"
fi
Expand Down

0 comments on commit 3b217e6

Please sign in to comment.