On Apr 20, 2013, at 9:19 AM, Paul Mackerras <pau...@samba.org> wrote:

> On Thu, Apr 11, 2013 at 01:02:48AM +0600, Tair Sabirgaliev wrote:
>> 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 trivial: if we are on OSX, emulate Cmd-Shift-TAB
>> key event, so that the gitk application window is brought
>> from bottom to top.
> Is this really the only way to do it?  It seems a bit hacky to me.  I
> would think you should be able to use the "wm" command to achieve what
> you want.  I don't use Mac OS, so I don't know exactly how Tcl/Tk
> behaves on it, but this page looks like it might hold some clues for
> what you want to do:
> http://teapot.activestate.com/package/name/windowlist/ver/1.4/arch/tcl/file.tm

Today I did some further investigations on reasons app windows going behind. 
Turns out this is not something specific to Tcl/Tk. 

On OSX, GUI applications can be launched from Terminal in 2 ways:
1. Interactively, directly using app executable:
         sh$ /Applications/Chess.app/Contents/MacOS/Chess
2. Asynchronously, using OSX 'open' facility
         sh$ open -a Chess

The problem with 1st way is that OSX always puts the new app window behind 
the others, thus making sure the focus remains at Terminal input. 

The problem with the 2nd approach is that app is launched 'asynchronously', 
detached from Terminal, so when you close the app, focus doesn't necessarily 
return back to Terminal as it would normally do in Linux for example.

So, yes, this is a really hacky workaround, but it consistently takes the 
launched app window to foreground on most modern OSX versions.

And regarding the link you provided -- I tried them, unfortunately the 
there don't bring the application to foreground. Looks like they are mostly 
to manipulate windows within a single multi-window application.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to