fix: notifications not displaying for menu bar app#20
Open
masonc15 wants to merge 1 commit intoangristan:mainfrom
Open
fix: notifications not displaying for menu bar app#20masonc15 wants to merge 1 commit intoangristan:mainfrom
masonc15 wants to merge 1 commit intoangristan:mainfrom
Conversation
Owner
|
Interesting, this sounds legit but I wonder why notifications work for me? |
Author
|
Yeah, I figured as much - definitely weird. I'm running MacThrottle on an M2 Macbook Air on Tahoe 26.2. Not sure if other people have experienced the same notification bug, but this patch got it working for me at least. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed notifications weren't triggering on my Mac despite having them enabled in the menu. After investigating, I found the root cause: macOS silences notifications for foreground apps by default, and menu bar apps like MacThrottle (configured with
LSUIElement, meaning no Dock icon) are treated as foreground.The fix implements
UNUserNotificationCenterDelegateand adds thewillPresentdelegate method to explicitly request banner presentation. This affects all users on all macOS versions since 10.14 Mojave.Changes:
UNUserNotificationCenterDelegateconformance toThermalMonitorwillPresentto call completion handler with.bannerand.soundI've found this utility invaluable and have been using it constantly since reading your blog post a few weeks ago. I'm slightly new to OSS development, so let me know if I should change or improve anything. Thanks!