Open Oasixer opened 3 weeks ago
i also am looking for such an option; my workflow involves two monitors, each monitor with a terminal; 1 left and 1 right
And i am switching between them quite frequently.
At the moment i am using a script created with chatgpt
#!/bin/bash
# Get the focused window information
focused_window=$(/usr/local/bin/aerospace list-windows --focused)
# Extract the window name from the focused window
window_name=$(echo "$focused_window" | awk -F'|' '{print $2}' | xargs)
# Get the ID of the focused window
focused_id=$(echo "$focused_window" | awk '{print $1}')
# Get all windows with the same name
same_name_windows=$(/usr/local/bin/aerospace list-windows --all | grep "$window_name")
# Find the next window ID
next_window_id=""
found_current=false
while read -r line; do
id=$(echo "$line" | awk '{print $1}')
if [ "$found_current" = true ]; then
next_window_id=$id
break
fi
if [ "$id" = "$focused_id" ]; then
found_current=true
fi
done <<< "$same_name_windows"
# If we didn't find a next window, wrap around to the first one
if [ -z "$next_window_id" ]; then
next_window_id=$(echo "$same_name_windows" | awk 'NR==1 {print $1}')
fi
# Focus the next window
/usr/local/bin/aerospace focus --window-id $next_window_id
But feels kinda slow :'(
I am using AltTab to do so, this is the only application I found that can switch between windows of a application. I guess it is compatible with Aerospace.
there is a macOS standard for that in the system settings should be CMD + tilde
there is a macOS standard for that in the system settings should be CMD + tilde
I can't get any of these built-in keybinds to replicate that behavior, could you share the name of that shortcut in the settings?
it's the "Move focus to next window" (of same application).
Depending where you live (I am from Germany) the standard-key can slightly differ, but you can just choose a new one for that. I just pressed CMD and the key above TAB for that.
it's the "Move focus to next window" (of same application).
Thanks, this does exactly what I wanted!
Well, i found the setting 'Move focus to next window" and i mapped it to cmd + `
But doesn't really working for me, only inserting inside the terminal `. sadness; oh well, i guess until i make it work i will fallback to my above script.
Try it with a another shortcut first, like cmd ctrl alt Shift a. It was also not running for me with the ` character since I am located in Germany. I changed it to cmd ^ which is the qwertz key next to 1. Often trouble starts with the layout. Maybe you are running another software layout than your hardware shows.
Nope, tried multiple keybinds, none works
Edit: i actually managed to make that work on another MacBook, so i think there's something wrong with mine
Nope, tried multiple keybinds, none works
Edit: i actually managed to make that work on another MacBook, so i think there's something wrong with mine
this only works for window that is active, which means not working for hidden, minimized windows. The only application I found working for windows of same application no matter what status is the window at, is AltTab, not working with apple script, not system shortcut like others mention.
Hi, I'm wondering what's the easiest way to create a keybind to switch between windows of the same application ie. if I'm in finder, a keybind to focus the next finder window? I realize this is probably scriptable with the existing commands, but I'd rather not reinvent the wheel if this is an existing recipe.
If needed, I can work on scripting this myself, but I figure it's still worth creating an issue for this for the purpose of future searchability so others can copy the result.
Cheers