#!/bin/bash if [ ! -f /tmp/waybar-notif ]; then printf '{"text":"","class":""}\n' exit 0 fi text=$(cat /tmp/waybar-notif) urgency=$(cat /tmp/waybar-notif-urgency 2>/dev/null | tr '[:upper:]' '[:lower:]') urgency="${urgency:-normal}" icon=$'' # Escape backslashes and quotes in text to keep JSON valid text=$(printf '%s' "$text" | sed 's/\\/\\\\/g; s/"/\\"/g') printf '{"text":"%s %s","class":"%s"}\n' "$icon" "$text" "$urgency"