summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2013-06-06 08:17:47 (GMT)
committerPat Thoyts <patthoyts@users.sourceforge.net>2013-06-07 00:34:42 (GMT)
commit7d2017e7738ace254d0b653ce844d07af8ecf026 (patch)
tree8e013213c2c02f87447c2881817504e9b01285a3
parented05e9f6c027a23ce45bcdbac4196058ed5d0e07 (diff)
downloadgit-7d2017e7738ace254d0b653ce844d07af8ecf026.zip
git-7d2017e7738ace254d0b653ce844d07af8ecf026.tar.gz
git-7d2017e7738ace254d0b653ce844d07af8ecf026.tar.bz2
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 76bf6ff93e.) 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>
-rwxr-xr-xgit-gui.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/git-gui.sh b/git-gui.sh
index e133331..7031759 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -137,6 +137,20 @@ unset oguimsg
######################################################################
##
+## On Mac, bring the current Wish process window to front
+
+if {[tk windowingsystem] eq "aqua"} {
+ catch {
+ exec osascript -e [format {
+ tell application "System Events"
+ set frontmost of processes whose unix id is %d to true
+ end tell
+ } [pid]]
+ }
+}
+
+######################################################################
+##
## read only globals
set _appname {Git Gui}