Created
November 6, 2025 09:23
-
-
Save yannbertrand/961a2164aabdf36fd84c81cc62ba4ece to your computer and use it in GitHub Desktop.
aerospace pip-move
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| focused_workspace=$(aerospace list-workspaces --focused) | |
| nb_of_monitors=$(aerospace list-monitors | wc | awk '{print $1}') | |
| focused_monitor=$(aerospace list-monitors --focused | awk '{print $1}') | |
| pip_windows=$(aerospace list-windows --all --format " %{window-id}%{right-padding} | %{monitor-id}%{right-padding} | %{window-title}" | grep -E "(Picture-in-Picture|Picture in Picture)") | |
| echo $pip_windows | while read window; do | |
| window_id=$(echo $window | awk '{print $1}') | |
| monitor_id=$(echo $window | awk '{print $3}') | |
| if [ -n "$window_id" ]; then | |
| if [ "$nb_of_monitors" -gt 1 ]; then | |
| # If multiple monitors, only move on wanted one | |
| if [ "$monitor_id" -eq "$focused_monitor" ]; then | |
| aerospace move-node-to-workspace --window-id "$window_id" "$focused_workspace" | |
| fi | |
| else | |
| # Move PiP windows to current workspace (handles both "Picture-in-Picture" and "Picture in Picture") | |
| aerospace move-node-to-workspace --window-id "$window_id" "$focused_workspace" | |
| fi | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
inspired by nikitabobko/AeroSpace#2