Is it possible to have a window come to my current space when called? #1939
-
Hopefully that makes some sense, aha. In short I use an app to debug code while working on it and would like to be able to "summon" it to the space that I'm on when I use a hotkey to activate it. Let's say I'm on space 6 but the debugger is on space 1, if I push the hotkey to activate the app can I instead of moving to space one have it come to space 6? I know that this might be skhd territory as well, but it kind of lives in the middle as I see it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The manual readonly WINDOW_NAME="Spotify"
readonly CURRENT_SPACE=$(yabai -m query --spaces | jq '.[] | select(."has-focus" == true).index')
readonly TARGET_WINDOW=$(yabai -m query --windows | jq "map(select(.title == \"$WINDOW_NAME\"))[-1].id")
yabai -m window --focus $TARGET_WINDOW
yabai -m window --space $CURRENT_SPACE
sleep 0.1
yabai -m window --focus $TARGET_WINDOW
Edit to adjust to koekeishiyas additions: readonly WINDOW_NAME="Spotify"
readonly CURRENT_SPACE=$(yabai -m query --spaces --space | jq '.index')
readonly TARGET_WINDOW=$(yabai -m query --windows | jq "map(select(.title == \"$WINDOW_NAME\"))[-1].id")
yabai -m window $TARGET_WINDOW --space $CURRENT_SPACE --focus |
Beta Was this translation helpful? Give feedback.
The manual
man yabai
andjq
is very helpful when making custom queries and behavior. The below code summonsSpotify
to the current space. I can be saved as a script~/config/yabai-scripts/summon-spotify-to-current-space.sh
, make it executable and invoke it fromskhd
with your chosen shortcut.yabai
can be quite annoying when switching…