Skip to content

Need help with destroy space when empty script #750

Answered by tbsmn
tbsmn asked this question in Q&A
Discussion options

You must be logged in to vote

I finaly figured it out myself. The problem was that spaces have an "id" and an independent "index":
If anyone is interessted here is the code that works:

yabai -m signal --add event=space_changed action='RSINDEX=$(yabai -m query --spaces | jq ".[] | select (.id == $YABAI_RECENT_SPACE_ID) | .index") && if [ "$(yabai -m query --spaces --space $RSINDEX | jq -re '.windows')" = "[]" ] ; then yabai -m space $RSINDEX --destroy ; fi'

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@dominiklohmann
Comment options

@Bellavene
Comment options

@tbsmn
Comment options

Answer selected by dominiklohmann
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #750 on December 11, 2020 14:22.