Skip to content

Instantly share code, notes, and snippets.

@replaid
Created July 8, 2020 09:23
Show Gist options
  • Save replaid/fd90ef14ecc13b0c470c491bd5823438 to your computer and use it in GitHub Desktop.
Save replaid/fd90ef14ecc13b0c470c491bd5823438 to your computer and use it in GitHub Desktop.
Give Zenity foreground on macOS
#!/usr/bin/env bash
zenity --password &
zenity_pid=$!
osascript<<EOF
tell application "System Events"
set processList to every process whose unix id is $zenity_pid
repeat with proc in processList
set the frontmost of proc to true
end repeat
end tell
EOF
# Can't use fg by default, that's for interactive shells.
# But this waits for all background processes to finish.
wait
@replaid
Copy link
Author

replaid commented Jul 8, 2020

All this was inspired by withfig.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment