Skip to content

Instantly share code, notes, and snippets.

@keturiosakys
Created October 29, 2022 13:48
Show Gist options
  • Save keturiosakys/16bac1951a3ae87915ce1415d92937d5 to your computer and use it in GitHub Desktop.
Save keturiosakys/16bac1951a3ae87915ce1415d92937d5 to your computer and use it in GitHub Desktop.
set appName to "WezTerm"
set yabaiQuery to "/opt/homebrew/bin/yabai -m query --windows | /opt/homebrew/bin/jq '.[] | select(.app==\"" & appName & "\") | .id'"
set windowId to do shell script yabaiQuery
if application appName is running then
tell application "System Events"
if visible of application process appName is true then
set visible of application process appName to false
else
set visible of application process appName to true
set yabaiCommand to "/opt/homebrew/bin/yabai -m window " & windowId & " --space mouse && /opt/homebrew/bin/yabai -m window --focus " & windowId
do shell script yabaiCommand
end if
end tell
else
tell application appName to activate
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment