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 <reedwade@misterbanal.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Reed Wade 4 years ago committed by Maarten van Gompel
parent e11d3aaea3
commit 1edb932f44
  1. 2
      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"

Loading…
Cancel
Save