Prevent Mac OS App window from stealing focus - Swift/Cocoa (GitHub Repo) - swift

This is an open-source OS X app which displays lyrics of a song currently playing in a Music Player...
https://github.com/ddddxxx/LyricsX
It creates an NSScrollview/NSTextview window which displays lyrics, with this piece of code (correct me if i'm wrong) -
https://github.com/ddddxxx/LyricsX/blob/master/LyricsX/View/ScrollLyricsView.swift
The issue is, when the said Lyrics Window is placed in a Space
(Mission Control), the window will steal focus whenever you swipe to
another space (two finger swipe via mouse/trackpad or keyboard
shortcut) it will cause you to revert back to space containing the
Lyrics Window.
For example, if the lyrics window is on "Desktop 1" and you swipe to
"Desktop 2", the system will immediately switch back to "Desktop 1"
and bring the lyrics window in focus.
I'm quite new to Swift/Cocoa so I would love some help figuring out how to make sure the Lyrics window is NEVER in focus. I wouldn't mind outright disabling focus of the window entirely.
PS. Is this piece of code interfering/causing this behavior?
https://github.com/ddddxxx/LyricsX/blob/master/LyricsX/Controller/AutoActivateWindowController.swift

Related

When the app is turned off or switched, the keyboard becomes stuck or disappears

When I open a keyboard and then move my app to recent apps or switch, when I return, there is no keyboard on my screen but it occupies the area of the keyboard and appears a white area, and then the keyboard does not open and neither that portion goes until I remove that app and then reopen it. It is especially noticeable on iOS; the same project works perfectly on Android.
My project is in Flutter, and I am using GetX for state management.
The link to the video of the error is given below.
https://drive.google.com/file/d/1NcQGIdHkTRopWM3M33vM4XvKmyC59zHn/view?usp=share_link
I try adding "life cycle" and then adding these lines, but nothing happens.
FocusManager.instance.primaryFocus?.unfocus();
SystemChannels.textInput.invokeMethod('TextInput.hide');

Why does pressing up button in VS Code for Mac switch focus instead of taking me to the previous line

I have Googled this extensively and have got nowhere.
When I press the up button in VS Code for Mac, instead of taking me to the previous line, it sometimes, randomly, shifts focus to other areas, like the terminal, the notification symbol (bottom right), and file browser.
See screen recording attached.
https://www.youtube.com/watch?v=GdVtBcUV48o

NSPopover OS X Application

I am developing a menu bar application for os x. I am using NSPopover to create a popup window.
However when some other application is full screen that popup is not visible. What settings should be set, so that popup window is always on top.
I struggled with this as well. When I had this problem, I created a invisible window that would flow above all other windows, including full screen ones. The window would then activate the popover.
However, I found a much cleaner solution here.

Why isn't reveal.js slide notes mode advancing fragments?

I have been working on some slides using reveal.js, and they're being hosted on gh-pages. I have encountered a strange problem that I was hoping someone could help with.
Looking at my slides, I hit "s" to enter Slide Notes mode. The window appears correctly, the timer starts, and all that good stuff. The presentation and slide notes windows stay in sync when it comes to advancing to the next slide at the right time.
The problem is that when I advance the slides hoping to show the next fragment, the fragments advance ONLY in the window that has focus. In other words, if I focus on the Slide Notes window and hit the right key, then the slide notes window correctly shows the next fragment but the presentation does not; if I focus on the Presentation window and hit the right key, then the presentation correctly shows the next fragment but the slide notes do not.
Does anyone have any ideas about what might be wrong?

switching between help and code window

I just found out how to have help open and the code editor open at the same time from an answer to this question: Opening Xcode help file and application at the same time
In Windows, Alt+Tab switched me back and forth to my hearts content. Here, Alt tab bring up the next open application (happens to be Firefox in my case).
How do I switch between the Xcode window and the help window?
Cmd+` and Cmd+Shift+` will switch back and forth between windows within a Mac application.
You can also use F10 to see all of the application's windows in a zoomed out view and pick one to focus with the mouse or keyboard.