Open rpc31 opened 1 month ago
Have you tried https://github.com/lwouis/alt-tab-macos ? It can show only windows those are on a focused Desktop, e.g.: AltTab Settings > Controls > Shortcut 1 > Show windows from: "Screen showing AltTab".
Seems like you are describing the new "scratchpad" feature. Personally i set up some apps to be scratchpads (Spotify, Slack, Calendar etc.), and keybinds to toggle them on/off.
Let's say I'm on space 1, i hit spotify key, i see spotify as a floating window, i switch to space 2 (thus some other app on it), i hit spotify key, i get the window on space 2
I don't use cmd+tab though, just some custom keybinds to switch spaces, so i'm not sure this flow will fork %100 for you
@vsuharnikov yes I come from alt-tab, where the dev recommended me yabai as alt-tab does not have any power/feature to control the windows themselves.
@cagdassalur oh that my be the solution! Is is still in beta or is it a stable feature? Also I can't find a way to setup this new scratchpad. feature, I don't even find it in the wiki :(
@rpc31 you can always see most up-to-date info with man yabai
Here's a minimal example
# .yabairc
yabai -m rule --add app="^Spotify$" scratchpad="Spotify" opacity=".95" grid="11:11:1:1:9:9"
# .skhdrc
alt + shift + ctrl - y : yabai -m window --toggle Spotify || open -a Spotify
With this, your key should toggle spotify on and off, and when it's on it should stay on the space you opened it. Didn't get your full flow so not sure if you want something to work with more apps at once without specific keybinds for each of them. But if this isn't it probably there will be a way to set it up, let me know.
I have a bit different setup, closes current open scratchpad window when opening another one, so i don't have multiple active windows at the same time. Also i use it to reset the grid so i can freely adjust the size and not have it permanent. kitty setup is a guake like dropdown terminal with a custom session
# .skhd, mapping some of my keyboard keys to specific apps
alt + shift + ctrl - 5 : ~/.scripts/pipper.sh toggle kitty
alt + shift + ctrl - 6 : ~/.scripts/pipper.sh toggle Slack
alt + shift + ctrl - y : ~/.scripts/pipper.sh toggle Calendar
alt + shift + ctrl - s : ~/.scripts/pipper.sh toggle Spotify
alt + shift + ctrl - 4 : ~/.scripts/pipper.sh toggle "Firefox Nightly"
# .yabairc
yabai -m rule --add app="^Spotify$" scratchpad="Spotify" opacity=".95" grid="11:11:1:1:9:9"
yabai -m rule --add app="^Slack$" scratchpad="Slack" opacity=".95" grid="11:11:1:1:9:9"
yabai -m rule --add app="^Calendar$" scratchpad="Calendar" opacity=".95" grid="11:11:1:1:9:9"
yabai -m rule --add app="^kitty$" title="^freebird" scratchpad="kitty" opacity=".9" grid=3:3:0:0:3:1
# pipper.sh
toggle() { yabai -m window --toggle "$NAME" || open -a "$NAME" }
kitty_toggle() {
yabai -m window --toggle "kitty" ||
nohup kitty --title freebird --session ~/.config/kitty/sessions/freebird &
}
toggle_others() {
yabai -m window $(
yabai -m query --windows |
jq -r "[.[] | select(.scratchpad != \"\" and .scratchpad != \"$NAME\" and .\"is-visible\"==true)
| \"--toggle \" + .app ] | join(\" \")"
)
}
NAME="$2"
if [[ $1 == "toggle" ]]; then
[[ $NAME == "kitty" ]] && kitty_toggle || toggle
toggle_others
# yabai -m rule --apply # Messes with the Arc hack, need to give the current window id
fi
fun fact: I used to have a long hacky messy script just to have this functionality, with non-ideal result with app's secondary windows and menus going everywhere, trying not to clash layers above/below. And having it run instantly on keypress while querying a ton of things to understand if an app is showing/hiding/not running . -m query
was not fast enough so i had to cache app pids and everything, proper mess. Now we have this amazing feature built-in, really appreciate that we have this and working so good.
One of my biggest annoyance with cmd-tab is that apps are too much little smart when it comes to desktop occupancy
If an App (ex. mail) is assigned to non desktop (by default) and opened in desktop 1 (ex. personal). If I cmd-tab (or alt-tab) this app from desktop 2 (ex. work), then I am "pulled" myself to desktop 1, losing context of what I wanted to write.
If an App (ex. mail) is assigned to all desktops, then, let say I am writing an email on desktop 1 (personal) and quickly want to see an operation being run on chrome on desktop 2 (work), then Mail is "pulled" with me and I have to hide it to see what I wanted to see.
Can Yabai handle this kind of issue ?
Is there a way, when I use command tab to select a running macOS app on another desktop, to "pull" and bring the app to my current desktop rather than me being pulled to where lives the app? (or to automatically "hide" the focused app when I switch to another desktop?)