From 1edb932f440433b8f1b812e6836f9d4cb295e503 Mon Sep 17 00:00:00 2001 From: Reed Wade Date: Fri, 30 Oct 2020 16:50:51 +0100 Subject: [PATCH] fix a bug on picked notification file determination If a notification body include a double whitespace, the PICKEDNOTIFFILE computation fail to match cause we striped them when building the dmenu choices. To give an example, try to write this notification as $ sxmo_notificationwrite.sh "random" \ "st -e tail -n9999 -f \"$HOME/.config/sxmo/xinit\"" \ "$HOME/.config/sxmo/xinit" \ "this body is broken" This patch fix this bug. (Maintainer note: I changed the awk invocation to use tr, as suggested by anjan) Signed-off-by: Reed Wade Signed-off-by: Maarten van Gompel --- scripts/notifications/sxmo_notificationsmenu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/notifications/sxmo_notificationsmenu.sh b/scripts/notifications/sxmo_notificationsmenu.sh index fddef71..19472c4 100755 --- a/scripts/notifications/sxmo_notificationsmenu.sh +++ b/scripts/notifications/sxmo_notificationsmenu.sh @@ -24,7 +24,7 @@ notificationmenu() { [ "$PICKEDCONTENT" = "Close Menu" ] && exit 1 [ "$PICKEDCONTENT" = "Clear Notifications" ] && rm "$NOTIFDIR"/* && exit 1 - PICKEDNOTIFFILE="$(echo "$CHOICES" | grep "$PICKEDCONTENT" | cut -d^ -f2 | tr -d ' ')" + PICKEDNOTIFFILE="$(echo "$CHOICES" | awk '{$1=$1};1' | grep "$PICKEDCONTENT" | cut -d^ -f2 | tr -d ' ')" NOTIFACTION="$(head -n1 "$PICKEDNOTIFFILE")" setsid -f sh -c "$NOTIFACTION" & rm "$PICKEDNOTIFFILE"