]> git.ipfire.org Git - thirdparty/git.git/commitdiff
gitk: On OSX, bring the gitk window to front
authorTair Sabirgaliev <tair.sabirgaliev@bee.kz>
Wed, 24 Apr 2013 09:48:27 +0000 (15:48 +0600)
committerPaul Mackerras <paulus@samba.org>
Mon, 13 May 2013 11:29:43 +0000 (21:29 +1000)
On OSX, Tcl/Tk application windows are created behind all
the applications down the stack of windows.  This is very
annoying, because once a gitk window appears, it's the
downmost window and switching to it is pain.

The patch is: if we are on OSX, use osascript to
bring the current Wish process window to front.

Signed-off-by: Tair Sabirgaliev <tair.sabirgaliev@gmail.com>
Thanks-to: Stefan Haller <lists@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk

diff --git a/gitk b/gitk
index 22a05b0373c027a3ea10fd2d5093e1057464b37b..5cd00d80fe2fb80a07a59b7e5327f8ff6c29d8f6 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -11751,6 +11751,15 @@ if {[catch {package require Tk 8.4} err]} {
     exit 1
 }
 
+# on OSX bring the current Wish process window to front
+if {[tk windowingsystem] eq "aqua"} {
+    exec osascript -e [format {
+        tell application "System Events"
+            set frontmost of processes whose unix id is %d to true
+        end tell
+    } [pid] ]
+}
+
 # Unset GIT_TRACE var if set
 if { [info exists ::env(GIT_TRACE)] } {
     unset ::env(GIT_TRACE)