diff mbox series

[1/3] gitk: skip calling osascript to set frontmost for tk >= 8.6

Message ID 20210804010900.33133-2-carenas@gmail.com (mailing list archive)
State New, archived
Headers show
Series gitk: macOS improvements | expand

Commit Message

Carlo Marcelo Arenas Belón Aug. 4, 2021, 1:08 a.m. UTC
76bf6ff (gitk: On OSX, bring the gitk window to front, 2013-04-24) adds
an osascript to set the gitk window to the front to workaround and
unfortunate default in older tk versions to add it to the back.

tk 8.6 or newer do not need that workaround so add a conditional check
to skip it and while at it update the comment with the new name for the
OS.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 gitk | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/gitk b/gitk
index 23d9dd1..f68d983 100755
--- a/gitk
+++ b/gitk
@@ -12288,13 +12288,15 @@  if {[catch {package require Tk 8.4} err]} {
     exit 1
 }
 
-# on OSX bring the current Wish process window to front
+# on macOS bring the current Wish process window to front if needed
 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] ]
+    if {$tcl_version < 8.6} {
+        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