#!/bin/bash
monitor="$1"

monitor_status() {
    for tag in $(herbstclient tag_status "$monitor")
    do
        case "${tag:0:1}" in
            '#'|'+') echo "tag_${tag:1}_status|string|viewed" ;;
            '%'|'-') echo "tag_${tag:1}_status|string|on_other" ;;
            '!') echo "tag_${tag:1}_status|string|urgent" ;;
            *)echo "tag_${tag:1}_status|string|hidden" ;;

        esac
    done
    echo
}

monitor_status

while IFS=$'\t' read -ra event
do
    case ${event[0]} in
        tag_changed) monitor_status ;;
        *) continue ;;
    esac

done < <(herbstclient --idle)
