[sketchybar] reset aerospace
change zxtxurxuoroqlqvouwplqkmwryrxqwyy
commit 093f21381c6029324313a899a77aa9470e369a4d
author Alpha Chen <alpha@kejadlen.dev>
date
parent ksoyoxkv
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
new file mode 100644
index 00000000..b7eed75b
--- /dev/null
+++ b/.claude/settings.local.json
@@ -0,0 +1,8 @@
+{
+  "permissions": {
+    "allow": [
+      "Bash(aerospace list-workspaces:*)"
+    ],
+    "deny": []
+  }
+}
\ No newline at end of file
diff --git a/.config/sketchybar/plugins/aerospace.sh b/.config/sketchybar/plugins/aerospace.sh
index 2859206e..660f67ba 100755
--- a/.config/sketchybar/plugins/aerospace.sh
+++ b/.config/sketchybar/plugins/aerospace.sh
@@ -3,9 +3,6 @@
 # Original source:
 #   https://nikitabobko.github.io/AeroSpace/goodness#show-aerospace-workspaces-in-sketchybar
 
-# https://stackoverflow.com/a/47541882
-if printf '%s\0' "${argv[@]}" | grep -F -x -z -- "$FOCUSED_WORKSPACE"; then
-    sketchybar --set "$NAME" label="$FOCUSED_WORKSPACE" background.drawing=on
-else
-    sketchybar --set "$NAME" label="$FOCUSED_WORKSPACE" background.drawing=off
-fi
+# Update the current workspace label
+CURRENT_WORKSPACE=$(aerospace list-workspaces --focused)
+sketchybar --set $NAME label="$CURRENT_WORKSPACE"
diff --git a/.config/sketchybar/sketchybarrc b/.config/sketchybar/sketchybarrc
index 2b14c2d0..302cd6f6 100755
--- a/.config/sketchybar/sketchybarrc
+++ b/.config/sketchybar/sketchybarrc
@@ -38,17 +38,11 @@ sketchybar --default "${default[@]}"
 ### Aerospace
 
 sketchybar --add event aerospace_workspace_change
-for monitor in $(aerospace list-monitors | awk '{print $1}'); do
-  # pass in workspaces since it takes a noticeable amount of time to run
-  workspaces=($(aerospace list-workspaces --monitor "$monitor"))
-  sketchybar --add item aerospace.$monitor left \
-             --subscribe aerospace.$monitor aerospace_workspace_change \
-             --set aerospace.$monitor \
-                   display=$monitor \
-                   icon.drawing=off \
-                   label="$(aerospace list-workspaces --focused)" \
-                   script="$CONFIG_DIR/plugins/aerospace.sh $workspaces"
-done
+sketchybar --add item current_workspace left \
+    --subscribe current_workspace aerospace_workspace_change \
+    --set current_workspace \
+    label="$(aerospace list-workspaces --focused)" \
+    script="$CONFIG_DIR/plugins/aerospace.sh"
 
 ##### Adding Left Items #####
 # We add some regular items to the left side of the bar, where