jamf / Notifier

Swift project which can post macOS alert or banner notifications on 10.15+ clients
Apache License 2.0
125 stars 22 forks source link

open app not working under macOS 11.6 #15

Closed mallej closed 3 years ago

mallej commented 3 years ago

under macOS 11.6. using/Applications/Utilities/Notifier.app/Contents/MacOS/Notifier --type alert --message "TEST" --messageaction "/Applications/Safari.app/" does not open the app when clicking the notification. no problem with 11.5.2 i have noticed the same misbehavior with https://github.com/sheagcraig/yo , so it is probably a general problem with 11.6 ?

glenfarclas17 commented 3 years ago

I can confirm that on both Intel and M1 hardware, in macOS 11.6, neither the --messageaction nor --messagebuttonaction are working. Also can confirm they work fine in macOS 11.5.2 (intel) and 11.5.1 (m1). Almost certainly is a problem/change in 11.6

jridsdale commented 3 years ago

I can confirm this is an issue on M1, macOS Big Sur (20G165)

neilmartin83 commented 3 years ago

Confirmed on Intel macOS 11.6

macmule commented 3 years ago

So.. indeed there has been a change.. we're supposed to post a notification.. the apps don't need to be running.. then when the notification is clicked.. the app is notified..

If we amend notifier not to quit, then things work.. but this causes other issues..

$ /Users/ben/Library/Developer/Xcode/DerivedData/Notifier-fyrvpxvalveblfealonfwgaitjtj/Build/Products/Debug/Notifier\ -\ Notifications.app/Contents/MacOS/Notifier\ -\ Notifications --message "TEST" --messageaction "/Applications/Safari.app/" --verbose
2021-09-28 22:44:12.984 Notifier - Notifications[25407:783487] Notifier Log: banner - verbose enabled
2021-09-28 22:44:12.985 Notifier - Notifications[25407:783487] Notifier Log: banner - running on 10.15+
2021-09-28 22:44:12.985 Notifier - Notifications[25407:783487] Notifier Log: banner - ncMessage
2021-09-28 22:44:12.985 Notifier - Notifications[25407:783487] Notifier Log: banner - notificationString - TEST
2021-09-28 22:44:12.985 Notifier - Notifications[25407:783487] Notifier Log: banner - ncMessageAction
2021-09-28 22:44:12.985 Notifier - Notifications[25407:783487] Notifier Log: banner - notificationString - TESTOptional("/Applications/Safari.app/")
2021-09-28 22:44:12.985 Notifier - Notifications[25407:783487] Notifier Log: banner - ncContentbase64 - VEVTVE9wdGlvbmFsKCIvQXBwbGljYXRpb25zL1NhZmFyaS5hcHAvIik=
2021-09-28 22:44:12.985 Notifier - Notifications[25407:783487] Notifier Log: banner - notification request
2021-09-28 22:44:13.986 Notifier - Notifications[25407:783487] Notifier Log: banner - notification delivered
2021-09-28 22:44:16.040 Notifier - Notifications[25407:783487] Notifier Log: banner - message - interacted
2021-09-28 22:44:16.040 Notifier - Notifications[25407:783487] Notifier Log: banner - message - clicked
2021-09-28 22:44:16.040 Notifier - Notifications[25407:783487] Notifier Log: banner - message - userInfo [AnyHashable("messageAction"): /Applications/Safari.app/, AnyHashable("verboseMode"): enabled]
2021-09-28 22:44:16.041 Notifier - Notifications[25407:783487] Notifier Log: banner - message - Optional(/Applications/Safari.app/)
2021-09-28 22:44:16.041 Notifier - Notifications[25407:783487] Notifier Log: banner - opening Optional(["/Applications/Safari.app/"])
2021-09-28 22:44:16.042 Notifier - Notifications[25407:783487] Notifier Log: banner - opened Optional(["/Applications/Safari.app/"])
2021-09-28 22:44:16.042 Notifier - Notifications[25407:783487] Notifier Log: banner - message - removing notification
2021-09-28 22:44:17.042 Notifier - Notifications[25407:783487] Notifier Log: banner - message - removing notification - done

https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter

haircut commented 3 years ago

As a note, this issue does not occur on macOS Monterey beta 7 nor beta 8. I did not test earlier beta versions.

The issue appears limited only to macOS 11.6.

niloque commented 3 years ago

Yesterday Apple released developer beta version of macOS 11.6.1. Decided to give it a go today and it seems Notifier is working as intended - I was able to launch an application directly from the notification using the following command: /Applications/Utilities/Notifier.app/Contents/MacOS/Notifier --type alert --message "TEST" --messagebutton "Open Firefox" --messagebuttonaction "/Applications/Firefox.app/"

macmule commented 3 years ago

Awesome, thanks @niloque.

🤞 this stays fixed in 11.6.1's release.

haircut commented 3 years ago

This was working in 11.6.1 RC1 build 20G211 but is now broken again in RC2 build 20G214.

niloque commented 3 years ago

@haircut Negative. I have 20G214 on a VM and just run the above command with success - the button on the Notifier's notification opened Firefox.

Also tried --messageaction "/Applications/Firefox.app/" and it worked as well.

haircut commented 3 years ago

@niloque Apologies, I was insufficiently clear.

On 20G214 I'm seeing the --messageaction flag work correctly, but --message still returns what I believe is placeholder text of "Notification."

The exact command of this original issue, /Applications/Utilities/Notifier.app/Contents/MacOS/Notifier --type alert --message "TEST" --messageaction "/Applications/Safari.app/", results in a notification where the "TEST" message is absent but the action works to open Safari.

Screen Shot 2021-10-07 at 12 54 32 PM

Can you confirm whether or not you are also seeing --message text fail to display?

niloque commented 3 years ago

This is the command I ran: /Applications/Utilities/Notifier.app/Contents/MacOS/Notifier --type alert --message "Test message here" --messageaction "/Applications/Firefox.app"

image

Previously I also put in "TEST" to the --message flag and it was displayed correctly.

haircut commented 3 years ago

I reinstalled 11.6.1 RC2 from recovery and it fixed the problem. This is working for me now.

It also continues to work in the 20G219 build of 11.6.1. ✅

macmule commented 3 years ago

Thanks, folks.. working in 11.6.1 release too!