Files
nixconfig/modules/home/wayland/apps/eww/bar/scripts/panel-toggle
2026-06-15 01:19:19 +02:00

19 lines
479 B
Bash
Executable File

#!/usr/bin/env bash
PANEL="$1"
# Atomic lock: flock acquires exclusively or exits immediately.
# Released automatically when the process exits (no trap needed).
exec 9>"/tmp/eww_panel_toggle.lock"
flock -n 9 || exit 0
CURRENT=$(eww get active-panel 2>/dev/null | tr -d '"')
if [ "$CURRENT" = "$PANEL" ]; then
eww update active-panel=""
eww close popup 2>/dev/null
else
eww update active-panel="$PANEL"
eww close popup 2>/dev/null
eww-open-on-current-screen popup
fi