Jump to content

More aggressive foreground


Recommended Posts

Hey Andrew and Vero and everyone else,

 

There is this thing I don't really know anything about: foreground priority taking. I mean Alfred is always in front of regular apps, but also always behind anything that tries to "always float on top". So I don't know how that works exactly but what I do know it's that alfred is very quick to pop in and out, and performs punctual actions, and I believe it should take priority over a "always on top" itunes mini player, a "stay on top" mpv or "float on top" vlc.

 

Could there be a way for alfred to take priority over itunes, vlc, mpv... and always be the frontmost app when popping in?

 

Cheers,

Florian.

Link to post
Share on other sites

As far as I know, there are ways to do this. An instance of NSWindow can be placed in a layer higher than NSNormalWindowLevel (the default), like NSFloatingWindowLevel.

 

The only hurdle is deciding which level to put the window on. There are higher levels than NSFloatingWindow, so other apps who have used these levels will be above Alfred.

 

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/WinPanel/Concepts/WindowLevel.html#//apple_ref/doc/uid/20000227-BAJDJEDA

Link to post
Share on other sites
  • 3 months later...
  • 4 weeks later...

One application to test with: mpv

Just run: mpv --ontop [some_video_file(s).mpg|some_photo_file(s).jpg]

Would be a lot more usable if it'd be always in front :)

The relevant code from MPV: https://github.com/mpv-player/mpv/blob/efe0fb75bc4bc3572edd241e60f31d620413a919/video/out/cocoa_common.m#L395

s->window_level = NSMainMenuWindowLevel + 2;
Edited by wolph
Link to post
Share on other sites
  • 1 month later...
  • 1 month later...

I'm making a few changes to the focus / key status in the next release, so I'll look at making Alfred NSMainMenuWindowLevel + 3 :)

 

Edit: Scratch that, unfortunately, that puts the QuickLook window behind Alfred so this change isn't possible.

Link to post
Share on other sites

I've been playing with this for a little while and it looks like OS X caps the window level of the preview window so there is no way around this issue. I'm reluctant to put in a hack (defaults write) to force Alfred's window level, but I've left this ticket open in my bug tracker to think about what can be done.

Link to post
Share on other sites
  • 1 month later...

I am super happy about this ! Really it's cool !

 

There is still an annoyance though... (sorry Andrew :-( ) in the form of the following: say I'm watching a TV series on my computer using the MPV player, one episode is about to end, so I pop Alfred up and start to look for the next episode. But MPV has the particularity of quitting when a video is over, thus giving the focus to the next application and escaping Alfred in the process.

 

Could there be a way for Alfred to remain active while the frontmost application changes? 

Link to post
Share on other sites

I am super happy about this ! Really it's cool !

 

There is still an annoyance though... (sorry Andrew :-( ) in the form of the following: say I'm watching a TV series on my computer using the MPV player, one episode is about to end, so I pop Alfred up and start to look for the next episode. But MPV has the particularity of quitting when a video is over, thus giving the focus to the next application and escaping Alfred in the process.

 

Could there be a way for Alfred to remain active while the frontmost application changes? 

 

In it's current form, this is a really hard thing for Alfred to differentiate from the standard behaviour (of close on focus lost)... I do have a ticket for it, but it may be a bit involving to fix so wouldn't be in a maintenance style release.

Link to post
Share on other sites

Wow, works great :)

Thanks Andrew!

As for losing focus, while that's indeed an annoyance it might be preferable behaviour to the potential bugs after fixing it. Switching applications and purposefully defocussing Alfred might not be possible otherwise. At the very least that should have to be configurable.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...