You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Aerospace as my wm and want Sketchybar to display:
only non-empty workspaces
the currently focused workspace (even if empty)
I wrote the following config., but I believe my subscriptions aren't working correctly. Every time workspace_manager.sh runs, it should sort and add workspace indicators. This script is triggered by the aerospace_workspace_changeevent, which works perfectly for my space.sh(highlighting the current space). However, for some reason, the workspaces don't reorder correctly. :(
e.g.
lets say I already have non-empty ws "1 2 4" and now open ws 3
desired would be "1 2 3 4" but I will have "1 2 4 3"
##### Adding Left Items ###### Add Aerospace workspace event handler
sketchybar --add event aerospace_workspace_change
# Add workspace manager
sketchybar --add item workspace_manager left \
--set workspace_manager \
icon.padding_left=0 \
icon.padding_right=0 \
label.padding_left=0 \
label.padding_right=0 \
script="$PLUGIN_DIR/workspace_manager.sh" \
--subscribe workspace_manager aerospace_workspace_change
# here might be the problem
workspace_manager.sh
#!/bin/bashecho"workspace_manager.sh triggered"# Get config directory
CONFIG_DIR="${CONFIG_DIR:-$HOME/.config/sketchybar}"source"$CONFIG_DIR/colors.sh"# Get workspace states
NON_EMPTY=($(/opt/homebrew/bin/aerospace list-workspaces --monitor focused --empty no))
FOCUSED=$(/opt/homebrew/bin/aerospace list-workspaces --focused)# Combine workspaces to show (non-empty + focused)
WORKSPACES_TO_SHOW=($(echo "${NON_EMPTY[@]}"$'\n'"$FOCUSED"| sort -n))
# Get existing space items from SketchyBar
EXISTING=($(sketchybar --query bar | jq -r '.items[] | select(startswith("space."))'))
# Remove workspaces that shouldn't be shownforexistingin"${EXISTING[@]}";do
sid=${existing#space.}# check if workspace is empty and not focusedif [[ !"${WORKSPACES_TO_SHOW[@]}"=~"${sid}" ]];then
sketchybar --remove "$existing"fidone# Add/update workspaces that should be shownforsidin"${WORKSPACES_TO_SHOW[@]}";doif! sketchybar --query "space.$sid"&> /dev/null;thenif [ $sid="11" ];then
LABEL="magic"#this is my equivalent to scratchpad in hyprlandelse
LABEL="$sid"fi
sketchybar --add item "space.$sid" left \
--set "space.$sid" \
background.color=0x44ffffff \
background.corner_radius=4 \
background.height=20 \
background.drawing=off \
label="$LABEL" \
click_script="/opt/homebrew/bin/aerospace workspace $sid" \
script="$CONFIG_DIR/plugins/space.sh $sid" \
update_freq=1 \
--subscribe "space.$sid" aerospace_workspace_change workspace_manager
# somewhere here should be the errorfidone# Force update
sketchybar --trigger workspace_update
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I use Aerospace as my wm and want Sketchybar to display:
I wrote the following config., but I believe my subscriptions aren't working correctly. Every time
workspace_manager.sh
runs, it should sort and add workspace indicators. This script is triggered by theaerospace_workspace_change
event, which works perfectly for myspace.sh
(highlighting the current space). However, for some reason, the workspaces don't reorder correctly. :(e.g.
lets say I already have non-empty ws "1 2 4" and now open ws 3
desired would be "1 2 3 4" but I will have "1 2 4 3"
My Setup:
aerospace.toml
sketchybarrc
workspace_manager.sh
space.sh
Issue Summary:
Subscription Issue?
workspace_manager.sh
should update sorted workspace indicators whenaerospace_workspace_change
is triggered, but it does not reorder them.space.sh
, which updates workspace highlighting.Possible Problem Areas:
--subscribe workspace_manager aerospace_workspace_change
line insketchybarrc
.--subscribe "space.$sid" aerospace_workspace_change workspace_manager
line inworkspace_manager.sh
.Does anyone know why the workspaces aren’t updating in the correct order?
Beta Was this translation helpful? Give feedback.
All reactions