git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
Aug 4, 2021, 01:08 UTC
Message-ID
<20210804010900.33133-2-carenas@gmail.com>
In-Reply-To
<20210804010900.33133-1-carenas@gmail.com>

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 --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
-- 
2.33.0.rc0.433.g9a510e7e11
Previous: Carlo Marcelo Arenas BelónNext: Carlo Marcelo Arenas Belón
Message 2 of 6 in “gitk: macOS improvements”
  1. 0/3 gitk: macOS improvementsCarlo Marcelo Arenas Belón, Aug 4, 2021
  2. 1/3 gitk: skip calling osascript to set frontmost for tk >= 8.6Carlo Marcelo Arenas Belón, Aug 4, 2021
  3. 3/3 gitk: check main window visibility before waiting for it to showCarlo Marcelo Arenas Belón, Aug 4, 2021
  4. Chris TorekAug 4, 2021
  5. 2/3 gitk: avoid fatal error if `exec osascript` failsCarlo Marcelo Arenas Belón, Aug 4, 2021
  6. Carlo ArenasAug 4, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.