[please reply inline rather than top-posting] On Thu, Jul 19, 2018 at 5:11 PM Evgeny Cherpak <cherpake@xxxxxx> wrote: > It seems this code placed at the end of the file, after getcommits() does the trick: > > if {[tk windowingsystem] eq "aqua"} { > set openscript [format { > open -a \"$(ps -p %d -o comm=)\" > } [pid] ] > exec osascript -e [format { > do shell script "%s" > } "$openscript” ] > } Interesting idea. A shortcoming of this approach is that it's non-deterministic. It will bring _any_ running gitk to the foreground, rather than the one mentioned by PID, which would be a potentially confusing regression. Such confusion _might_ be worse than simply not foregrounding the application at all (though that's a matter of opinion). Unfortunately, the 'open' command doesn't let you do so by PID, and Googling shows only answers which predate Mojave (that is, they all suggest Apple Events). To avoid such a regression on older MacOS's, it would be nice to retain the Apple Events code, but that would mean gitk would need to do a version check or something to avoid executing the Apple Events code on Mojave. By the way, the same problem presumably afflicts "git gui", which has identical code in it for foregrounding the application. Does that match with your experience?