Focus or Open specific app with shortcut
I recently started to use aerospace (coming from yabai & skhd), and I was struggling to find a way to open / focus specific apps
So I you have such need here my way of doing it, just replace APP_NAME by yours with your custom keybing, and it will be work for most app.
AeroSpace is using the .app name, so it's pretty straightforward, work just fine
⚠️ If for some reason your app is not the same as 'list-windows' output, you might want to change this a bit, and not using"APP_NAME" ⚠️
I was wondering if there is any easier way of doing it too (optimal way) ?
ctrl-cmd-g = 'exec-and-forget APP_NAME="Arc" && (aerospace focus --window-id "$(aerospace list-windows --all | awk -F"|" "/$APP_NAME/ {print \$1}" | awk "{print \$1}")" || open -n /Applications/$APP_NAME.app)'
ctrl-cmd-i = 'exec-and-forget APP_NAME="Alacritty" && (aerospace focus --window-id "$(aerospace list-windows --all | awk -F"|" "/$APP_NAME/ {print \$1}" | awk "{print \$1}")" || open -n /Applications/$APP_NAME.app)'
ctrl-cmd-s = 'exec-and-forget APP_NAME="Slack" && (aerospace focus --window-id "$(aerospace list-windows --all | awk -F"|" "/$APP_NAME/ {print \$1}" | awk "{print \$1}")" || open -n /Applications/$APP_NAME.app)'
ctrl-cmd-d = 'exec-and-forget APP_NAME="Discord" && (aerospace focus --window-id "$(aerospace list-windows --all | awk -F"|" "/$APP_NAME/ {print \$1}" | awk "{print \$1}")" || open -n /Applications/$APP_NAME.app)'
ctrl-cmd-n = 'exec-and-forget APP_NAME="Notion" && (aerospace focus --window-id "$(aerospace list-windows --all | awk -F"|" "/$APP_NAME/ {print \$1}" | awk "{print \$1}")" || open -n /Applications/$APP_NAME.app)'
ctrl-cmd-l = 'exec-and-forget APP_NAME="Linear" && (aerospace focus --window-id "$(aerospace list-windows --all | awk -F"|" "/$APP_NAME/ {print \$1}" | awk "{print \$1}")" || open -n /Applications/$APP_NAME.app)'
ctrl-cmd-o = 'exec-and-forget APP_NAME="Obsidian" && (aerospace focus --window-id "$(aerospace list-windows --all | awk -F"|" "/$APP_NAME/ {print \$1}" | awk "{print \$1}")" || open -n /Applications/$APP_NAME.app)'
Hope it will help some of you 🙏
Focus or Open specific app with shortcut
I recently started to use
aerospace(coming fromyabai&skhd), and I was struggling to find a way to open / focus specific appsSo I you have such need here my way of doing it, just replace APP_NAME by yours with your custom keybing, and it will be work for most app.
AeroSpace is using the .app name, so it's pretty straightforward, work just fine
I was wondering if there is any easier way of doing it too (optimal way) ?
Hope it will help some of you 🙏