Skip to content

Commit 7d2017e

Browse files
stefanhallerpatthoyts
authored andcommitted
git-gui: bring wish process to front on Mac
On Mac OS X, any application that is started from the Terminal will open behind all running applications; as a work-around, manually bring ourselves to the front. (Stolen from gitk, commit 76bf6ff.) We do this as the very first thing, so that any message boxes that might pop up during the rest of the startup sequence are actually seen by the user. [PT: added catch and moved down to ensure Tk has been loaded] Signed-off-by: Stefan Haller <stefan@haller-berlin.de> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
1 parent ed05e9f commit 7d2017e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

git-gui.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,20 @@ proc strcat {args} {
135135
::msgcat::mcload $oguimsg
136136
unset oguimsg
137137

138+
######################################################################
139+
##
140+
## On Mac, bring the current Wish process window to front
141+
142+
if {[tk windowingsystem] eq "aqua"} {
143+
catch {
144+
exec osascript -e [format {
145+
tell application "System Events"
146+
set frontmost of processes whose unix id is %d to true
147+
end tell
148+
} [pid]]
149+
}
150+
}
151+
138152
######################################################################
139153
##
140154
## read only globals

0 commit comments

Comments
 (0)