summaryrefslogtreecommitdiff
path: root/mac/.config/sketchybar/plugins/monitor_watcher.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mac/.config/sketchybar/plugins/monitor_watcher.sh')
-rwxr-xr-xmac/.config/sketchybar/plugins/monitor_watcher.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/mac/.config/sketchybar/plugins/monitor_watcher.sh b/mac/.config/sketchybar/plugins/monitor_watcher.sh
new file mode 100755
index 0000000..50868d3
--- /dev/null
+++ b/mac/.config/sketchybar/plugins/monitor_watcher.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+# Source colors for consistent theming
+source "$CONFIG_DIR/colors.sh"
+
+# Store current monitor state to detect changes
+MONITOR_STATE_FILE="/tmp/aerospace_monitor_state"
+
+# Get current monitor state
+CURRENT_MONITORS=$(aerospace list-monitors | awk '{print $1}' | sort | tr '\n' ' ')
+
+# Check if state has changed
+if [ -f "$MONITOR_STATE_FILE" ]; then
+ PREVIOUS_MONITORS=$(cat "$MONITOR_STATE_FILE")
+ if [ "$CURRENT_MONITORS" != "$PREVIOUS_MONITORS" ]; then
+ # Monitor configuration changed, update display
+ "$CONFIG_DIR/plugins/aerospace_display.sh"
+ fi
+else
+ # First run, create state file
+ "$CONFIG_DIR/plugins/aerospace_display.sh"
+fi
+
+# Save current state
+echo "$CURRENT_MONITORS" > "$MONITOR_STATE_FILE" \ No newline at end of file