Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you focus on the application once you send it to new a space and focus on that space? I still have to 'select' the space. #377

Closed
rublev opened this issue Jan 20, 2020 · 2 comments
Labels
help wanted Community help appreciated question Request for information or help, not an issue

Comments

@rublev
Copy link

rublev commented Jan 20, 2020

select the app*

@koekeishiya koekeishiya added help wanted Community help appreciated question Request for information or help, not an issue labels Jan 22, 2020
@rublev
Copy link
Author

rublev commented Jan 22, 2020

I think I solved this. Either way works for me now.

# create desktop, move window and follow focus - uses jq for parsing json (brew install jq)
# fix for above solution, to follow window and focus window
# https://github.com/koekeishiya/yabai/issues/160
shift + cmd - n : yabai -m space --create \
	&& wid="$(yabai -m query --windows --window | jq -r '.id')" \
	&& sidx="$(yabai -m query --spaces --display | jq -r 'map(select(."native-fullscreen" == 0))[-1].index')" \
	&& yabai -m window "${wid}" --space "${sidx}" \
	&& yabai -m window --focus "${wid}"

# create desktop and follow focus - uses jq for parsing json (brew install jq)
cmd + alt - n : yabai -m space --create \
	&& wid="$(yabai -m query --windows --window | jq -r '.id')" \
	&& sidx="$(yabai -m query --spaces --display | jq -r 'map(select(."native-fullscreen" == 0))[-1].index')" \
	&& yabai -m window "${wid}" --space "${sidx}"

# cycle through spaces
# https://github.com/koekeishiya/yabai/issues/303
alt - c : yabai -m space --focus "$(yabai -m query --spaces --display \
    | jq 'reverse | nth(index(map(select(.focused == 1))) - 1).index')"

# cycle backwards
alt - z : yabai -m space --focus "$(yabai -m query --spaces --display \
    | jq 'nth(index(map(select(.focused == 1))) - 1).index')"

@rublev rublev closed this as completed Jan 22, 2020
@boof-fo
Copy link

boof-fo commented Jun 7, 2022

doesn't work anymore because of a change in the JSON that yabai -m query --spaces --display returns.

updated commands:

# create desktop, move window and follow focus - uses jq for parsing json (brew install jq)
shift + cmd - n : yabai -m space --create \
        && wid="$(yabai -m query --windows --window | jq -r '.id')" \
        && sidx="$(yabai -m query --spaces --display | jq -r 'map(select(."is-native-fullscreen" == false))[-1].index')" \
        && yabai -m window "${wid}" --space "${sidx}" \
        && yabai -m window --focus "${wid}

# create desktop and follow focus - uses jq for parsing json (brew install jq)
cmd + alt - n : yabai -m space --create \
        && sidx="$(yabai -m query --spaces --display | jq -r 'map(select(."is-native-fullscreen" == false))[-1].index')" \
        && yabai -m space --focus "${sidx}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Community help appreciated question Request for information or help, not an issue
Projects
None yet
Development

No branches or pull requests

3 participants