Created
July 8, 2020 09:23
-
-
Save replaid/fd90ef14ecc13b0c470c491bd5823438 to your computer and use it in GitHub Desktop.
Give Zenity foreground on macOS
This file contains 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
#!/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 |
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
Probably can achieve everything through just the osascript command without all the GTK stuff anyway. This project is one example but all this could be rolled in shell/etc. plus osascript.
https://github.com/ncruces/zenity