[TxMt] Re: Focus with multiple windows and displays

Jacob Carlborg doob at me.com
Sun May 8 18:44:05 UTC 2016


On 2016-05-07 22:55, Allan Odgaard wrote:

> Seems like when an app is activated with no key window on the current
> screen, it’ll make the frontmost window key, so we can do a workaround
> by delaying setting the key window until after TextMate has become
> active, e.g.:
>
>      if(![NSApp isActive])
>      {
>          __weak __block id observerId = [[NSNotificationCenter
> defaultCenter]
> addObserverForName:NSApplicationDidBecomeActiveNotification object:NSApp
> queue:nil usingBlock:^(NSNotification*){
>              [aController showWindow:nil];
>              [[NSNotificationCenter defaultCenter]
> removeObserver:observerId];
>          }];
>          [NSApp activateIgnoringOtherApps:YES];
>      }

Where would I put this code to try it out?

-- 
/Jacob Carlborg



More information about the textmate mailing list