#!/bin/bash
# Toggle notification history display (mako version)
# Shows up to 10 previous notifications, or closes all if any are displayed

# Check if there are any notifications currently displayed
displayed=$(makoctl list 2>/dev/null | grep -c "^Notification" 2>/dev/null)

if [ "$displayed" -gt 0 ]; then
    # If notifications are showing, dismiss them all
    makoctl dismiss -a
else
    # If no notifications are showing, restore up to 10 from history
    for i in {1..10}; do
        makoctl restore 2>/dev/null || break
    done
fi
