fix(apps): improve Thunar and Mako integration
Some checks failed
Check / eval-and-lint (push) Has been cancelled

This commit is contained in:
Bernardo Magri
2026-05-31 20:58:10 +01:00
parent 878c11bd41
commit ea34a7ac1f
5 changed files with 52 additions and 6 deletions

View File

@@ -9,8 +9,20 @@ if (($# == 0)); then
fi
# Find the first notification whose 'summary' matches the regex in $1
notification_id=$(makoctl list | grep -F "$1" | head -n1 | sed -E 's/^Notification ([0-9]+):.*/\1/')
output=$(makoctl list)
if [[ -n $notification_id ]]; then
makoctl dismiss -n $notification_id
if [[ $output == "["* ]] || [[ $output == "{"* ]]; then
# JSON format (mako 1.8+)
# Structure is usually an array of notifications or a wrapper object
notification_id=$(echo "$output" | jq -r --arg pat "$1" '
if type == "array" then .
else .notifications // .data[0] // [] end
| .[] | select((.summary // .["summary-text"] // "") | contains($pat)) | .id' | head -n1)
else
# Human format (older mako)
notification_id=$(echo "$output" | grep -F "$1" | head -n1 | sed -E 's/^Notification ([0-9]+):.*/\1/')
fi
if [[ "$notification_id" =~ ^[0-9]+$ ]]; then
makoctl dismiss -n "$notification_id"
fi