From: Pat Thoyts <patthoyts@gmail.com>
To: Stefan Haller <stefan@haller-berlin.de>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] git-gui: bring Wish process to front on Mac
Date: Thu, 6 Jun 2013 15:09:32 +0100 [thread overview]
Message-ID: <CABNJ2G+h3zh+=wLA0KHjUn8TsfhqUK1Kn-1_=6hnXVRJUPhuuA@mail.gmail.com> (raw)
In-Reply-To: <1370506667-24576-1-git-send-email-stefan@haller-berlin.de>
On 6 June 2013 09:17, Stefan Haller <stefan@haller-berlin.de> wrote:
> 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.
>
> Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
> ---
> git-gui.sh | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/git-gui.sh b/git-gui.sh
> index e133331..c464928 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -29,6 +29,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}]
>
> ######################################################################
> ##
> +## On Mac, 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] ]
> +}
> +
> +
> +######################################################################
> +##
> ## Tcl/Tk sanity check
>
> if {[catch {package require Tcl 8.4} err]
> --
> 1.8.3.14.g33f718c
>
Seems fine to me. I can't test this as I have no access to this
platform. Possibly you should run this in a catch statement so it can
ignore any errors and I would tend to use the 'auto_execok' command to
ensure that osascript actually exists. Something like
set arg [format {tell application......}]
catch {exec {*}[auto_execok osascript] -e $arg [pid]}
but possibly this is guaranteed to exist on all macs which would make
the above redundant. What I'm thinking is you dont want the app to
exit just because something goes wrong in this call.
next prev parent reply other threads:[~2013-06-06 14:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 8:17 [PATCH] git-gui: bring Wish process to front on Mac Stefan Haller
2013-06-06 14:09 ` Pat Thoyts [this message]
2013-06-06 17:12 ` Stefan Haller
2013-06-07 21:56 ` [PATCH v2] " Stefan Haller
2013-06-14 17:54 ` Junio C Hamano
2013-06-15 23:07 ` Pat Thoyts
2013-06-06 18:15 ` [PATCH] " Junio C Hamano
2013-06-07 21:58 ` Stefan Haller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABNJ2G+h3zh+=wLA0KHjUn8TsfhqUK1Kn-1_=6hnXVRJUPhuuA@mail.gmail.com' \
--to=patthoyts@gmail.com \
--cc=git@vger.kernel.org \
--cc=stefan@haller-berlin.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).