Fix some issues

This commit is contained in:
Tobias Reisinger 2024-10-01 00:20:08 +02:00
parent b827471e6d
commit fb1e41ddc4
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 10 additions and 15 deletions

View file

@ -46,12 +46,16 @@ _ts_control_fetch() {
}
_ts_control_single_or_dmenu() {
options=$(echo "$1" | grep "$2")
filter="$2"
if [ "$filter" == "^$" ]; then
filter=""
fi
options=$(echo "$1" | grep "$filter")
count=$(echo "$options" | wc -l)
if [ "$count" -eq 1 ]; then
echo "$options"
else
echo "$options" | $DMENU
echo "$1" | $DMENU
fi
}
@ -90,8 +94,7 @@ handle_ntfy_events() {
done
}
# Add '$' to $1 to add 'End of line' to the regex for grep
action=$(_ts_control_single_or_dmenu "$actions" "$1$")
action=$(_ts_control_single_or_dmenu "$actions" "^$1$")
case $action in
"quick")