#!/bin/sh
# Ensure eww daemon is running
pgrep -x eww >/dev/null 2>&1 || eww daemon >/dev/null 2>&1 &
WINDOW="performance_monitor"
OVERLAY="dashboard_overlay"
# Display distro-specific Nerd Font icon in status bar
if [ -f /etc/arch-release ]; then
printf ' \n'
elif [ -f /etc/gentoo-release ]; then
printf ' \n'
else
printf ' \n'
fi
case $BLOCK_BUTTON in
1)
if eww active-windows 2>/dev/null | grep -q "$WINDOW"; then
eww update performance_monitor_visible=false
eww close "$WINDOW" "$OVERLAY"
else
eww update performance_monitor_visible=true
eww open "$OVERLAY"
eww open "$WINDOW"
fi
;;
3) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac