ddddxxx / LyricsX

🎶 Ultimate lyrics app for macOS.
Mozilla Public License 2.0
4.71k stars 386 forks source link

Lyrics Window steals focus when switching spaces #416

Open AlishaPink opened 4 years ago

AlishaPink commented 4 years ago

Love the app!! Beautiful design and very robust implementation.

This one issue has been frustrating me to no end... When the Lyrics Window is placed in a specific Space in Mission Control, (disabled always on top) the window will steal focus whenever you swipe (two fingers via the mouse of trackpad) to another space causing you to recent back to the space containing the Lyrics Window almost instantly.

This makes switching to other spaces unusable, it's probably an easy fix but an essential one.

ddddxxx commented 4 years ago

It doesn't happen on my device (macOS 10.15.6). Lyrics window is just a normal window. It doesn't observe space swiping event at all. Karaoke lyrics does however, for resizing itself when Dock show and hide as you switch between a space and full screen window. Are you sure it's lyrics window, not anything else steal focus?

AlishaPink commented 3 years ago

It definitely is the lyrics window, because I tested it on multiple devices (MacBook 10.15.6 and MacOS 10.11.6) without any other windows open except the Lyrics Window (not the karaoke lyrics)

This issue is not just on my end, it is a peculiar bug. Maybe the "always on top" button is causing the behavior even when deselected, or the NSview window is higher priority.

Something like this might fix it.....

NSApplication.shared.activate(ignoringOtherApps: true) or [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]

AlishaPink commented 3 years ago

I would really love for this to be fixed, cause I use this app everyday and this bug it really disrupting my workflow.

What can I do to help you solve this?

ddddxxx commented 3 years ago

Try this: LyricsX_1.5.6+2324.zip

Go to Menu -> Donate and click the QR code 10 times, a debug panel will pop out. Enable "Do not steal focus". This will disable all the NSApp.activate(ignoringOtherApps: true).

AlishaPink commented 3 years ago

Aww thank you so much for even doing this!! The secret menu is pretty cool, haha.

Unfortunately it still doesn't work 🙁 I'm very new to swift/cocoa so you know much better about this.... Maybe just disabling the whole NSApp.activate(ignoringOtherApps: true) isn't enough, and we need to make it false? -or- If nothing else, we can just make sure the window never gains focus, not #even my clicking on it, maybe something like this inside https://github.com/ddddxxx/LyricsX/blob/master/LyricsX/View/ScrollLyricsView.swift which is what is generating the window, I presume...

-(BOOL) shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent
{
    return YES;
}
#
-(void) mouseDown:(NSEvent *)theEvent
{
    [NSApp preventWindowOrdering];
}

PS. If you don't mind we can jump on Discord and I can share my screen and show you if it helps.

ddddxxx commented 3 years ago

This should work without need of extra setup: LyricsX_1.5.6+2327.zip

You can contact me on telegram: https://t.me/ddddxxxx