[sketchybar] only highlight aerospace workspace for multiple monitors
change ullypkxpztlmxulzsxwwprtkklztkrvt
commit 86467a4319b3625e09e6674da30a08933d75327a
author Alpha Chen <alpha@kejadlen.dev>
date
parent mkxwopru
diff --git a/.config/sketchybar/plugins/aerospace.sh b/.config/sketchybar/plugins/aerospace.sh
index c3b018f3..5fd8e7fb 100755
--- a/.config/sketchybar/plugins/aerospace.sh
+++ b/.config/sketchybar/plugins/aerospace.sh
@@ -30,23 +30,21 @@ update_monitor_workspace() {
 
     if [ -n "$workspace" ]; then
         local focused_workspace=$(aerospace list-workspaces --focused 2>/dev/null)
+        local monitor_count=$(aerospace list-monitors | wc -l)
 
-        if [ "$workspace" = "$focused_workspace" ]; then
+        # Only highlight if there are multiple monitors
+        if [ "$monitor_count" -gt 1 ] && [ "$workspace" = "$focused_workspace" ]; then
             # Highlight the focused workspace
             sketchybar --set $item_name \
                 label="$workspace" \
                 background.drawing=on \
-                background.color=0xffcccccc \
-                background.border_color=0xffcccccc \
-                background.corner_radius=6 \
-                background.height=26 \
                 label.padding_left=8 \
                 label.padding_right=8 \
                 padding_left=3 \
                 padding_right=3 \
                 label.color=0xff000000
         else
-            # Normal appearance for non-focused workspaces
+            # Normal appearance for non-focused workspaces or single monitor
             sketchybar --set $item_name \
                 label="$workspace" \
                 background.drawing=off \
diff --git a/.config/sketchybar/sketchybarrc b/.config/sketchybar/sketchybarrc
index 0aeac245..491e472c 100755
--- a/.config/sketchybar/sketchybarrc
+++ b/.config/sketchybar/sketchybarrc
@@ -51,6 +51,10 @@ if command -v aerospace >/dev/null 2>&1; then
             --set $item_name \
             label="$initial_workspace" \
             icon.drawing=off \
+            background.color=0xffcccccc \
+            background.border_color=0xffcccccc \
+            background.corner_radius=6 \
+            background.height=26 \
             script="$CONFIG_DIR/plugins/aerospace.sh"
     done
 fi