Skip to content
Discussion options

You must be logged in to vote

The following small script can do the job (replace com.apple.finder with whatever application you want to)

aerospace list-windows --workspace focused --format '%{window-id} %{app-bundle-id}' --json \
    | jq '.[] | select(."app-bundle-id" == "com.apple.finder") | ."window-id"' \
    | sort \
    | head -1 \
    | gxargs aerospace focus --window-id

gxargs is a GNU version of BSD xargs (brew install findutils). if the input is empty, the GNU version will run and forward aerospace failed exit code, BSD version won't run anything. It's a subtle difference, I don't know if you care

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@georgeamccarthy
Comment options

Answer selected by georgeamccarthy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants