-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notifications do not display #33
Comments
I saw this issue #10 and tried testing it with https://github.com/Pandawan/mac-notification-sys/tree/usernotifications and got the same result. [dependencies]
mac-notification-sys = { git = "https://github.com/Pandawan/mac-notification-sys.git", branch= "usernotifications" } |
Haven’t looked into your issue specifically, but the repo I linked in #10 (which you mentioned above) isn’t finished and still uses old notification system for the out-facing API. (i.e. the behavior should be the same between the two right now). |
Hmmm, strange, the code you sent works fine for me on my Intel Macbook Pro (2019, 13-inch) on macOS Monterey 12.1 with Rust 1.58 (stable-x86_64-apple-darwin). It seems like the only difference between our two cases is the M1 vs Intel, but I don't think the Notification API should be affected by this. Could you make sure that you don't have notifications disabled for terminal, or some kind of setting that could block notifications? If not this, I'm not sure how to test/reproduce this issue. |
These are my notification settings for both Terminal and iTerm2 (I tried on both these terminal clients). I tried switching the type of notification to alerts to see if that made any difference as well but still no success. I can get a notification to appear with this command however: |
There are two possible ways why there are no notifications displayed.
|
Same problem as @PfisterFactor, here with a Macbook Pro M1 2021 16" Monteray 12.1 and Rust 1.59. |
Are you sure you are not in Do Not Disturb (or other focus mode)? The notification isn't showing up at all on Notification Center either? I re-ran the exact code given in a new project with Rust 1.59 and macOS 12.2.1 and have no issues. It's strange that osascript is able to do it but not mac-notification-sys though... Perhaps we could look into modifying the objc part to have some debugging/logging to see what's happening... |
I double checked everything and I think everything is ok... Do Not Disturb isn't active and my Notification Center remains empty. |
I'm on 12.4 at the moment, and I am also unable to produce any notifications. My hardware:
rustup show:
|
Very strange. @PfisterFactor were you able to run the examples in this repo? Maybe there is a little more output since they are throwing deprecated warnings all over the place... Just tried to reproduce this issue again. Your example works fine for me on M1 and Intel... stable-aarch64-apple-darwin (default) and stable-x86_64-apple-darwin (default) |
For those who are running into this issue as well, pretty sure the issue (at least on macOS 12.0+) is that the My hacky workaround which works on the latest macOS has been to call out to osascript like so: |
@a5huynh Still, it’d be nice to figure out what the root of the problem is. |
I had the same problem reported here as @PfisterFactor, @a5huynh, @gandaldf, and @KSBilodeau. All of the tests would pass, and I could compile every example just fine. Every example would run without any errors, but I would never get any notifications. The examples would just exit without any errors. I was running the "sound" example and using Console.app, I traced the problem to a kernel error.
According to this, macOS version 10.15 and later introduced additional access control for the Desktop and Documents directory. The problem is that I was running the program from my If you're compiling and running this in your |
Thanks for digging into that @rstefanic. Just wanted to confirm that moving the folder outside of |
I can now reproduce that notifications don't show on M1/M2 devices. Still not able to pinpoint the issue (only spent about an hour or two at it). My first attempt was using @Pandawan's updated branch and then also playing around with codesigning. So far I no improvement. I'm still totally out of my comfort-zone here so, I can't tell whether there is some minutia to codesigning that I haven't considered yet. |
Fwiw, I have been able to get it codesigning and working when using a .app wrapper, but I seem to be unable to add the proper entitlements when embedding the Info.plist directly into the binary. (Or at least they don’t seem to be recognized/accepted) EDIT: I guess this response belongs more in #10 but w/e |
Anyway, things to check when it’s not working:
If none of these, then I have absolutely no idea |
@Pandawan did you ever see it work on an M1/M2 mac? |
I believe some people mentioned it working on M1/M2 but I am still on intel so I can’t verify. |
After moving the binary to the Adding a tip in the README can help save time. |
I made a minimal test program from one of the examples:
Running the program doesn't produce a notification, on both debug and release mode. It does not crash.
I'm on a M1 Macbook Pro (2021, 14-inch) on MacOS Monterey with Rust 1.58.
Compiling on stable-aarch64-apple-darwin or stable-x86_64-apple-darwin produces the same results.
The text was updated successfully, but these errors were encountered: