Notifications not works after Update to Version 3.870

Describe the bug

I have a lot of shortcuts which show a notification hint after execution. Mainly I use for this:

display notification "Something"

in a AppleScript action (blocking).

After updating to version 3.870, these were no longer displayed. Even a downgrade to version 3.826 did not help at first. Only after I had removed BTT from the apps section in this file (with PrefsEditor):

~/Library/Preferences/com.apple.ncprefs.plist

and restarted my Mac, I was asked again to set the settings for notifications and since then it works again.

Then after I updated back to version 3.870, it didn't work again. Also removing BTT from com.apple.ncprefs.plist did nothing. I was not asked again for the notification settings and had to go back to version 3.826.

Device information:

  • MacBook Pro 2019 (16'):
  • macOS version: 12.5.1
  • BetterTouchTool version: 3.870

Very weird issue. I think this might be an Apple bug but at least I can reproduce it. Maybe it's related to the Xcode version used for the build.

I'll try to figure out what's going on!

1 Like

Unfortunately this looks like a not solvable issue.

A few years ago (macOS 10.14 , Apple introduced a new way to send notifications. This new way gives apps more flexibiliy and Apple has deprecated the old way. That's why I recently switched to the new notification framework.

However it looks like Apple Script is internally still using the old Framework. Now that's a problem because apps can not mix using these frameworks ;-(

I will add a new scripting function in BTT and a new predefined action as a replacement. (This will then also allow to add images). Unfortunately I don't think I can make the standard "display notification" work anymore.

error 15:17:11.396513+0200 usernoted Legacy client com.hegenberg.BetterTouchTool connecting to modern client. You can't mix modern clients with legacy clients. <ClientConnect: 0x00000001391be800 identifier: com.hegenberg.BetterTouchTool pid: 80432 type: Application>

Hello Andreas,

somehow I can't believe this. That would mean that all apps with this framework would no longer be able to display notifications and not even those that allow script execution. All my other apps still work.

Does version 3.870 show any notification at all? I have not found an action to trigger this.

Only apps that run Apple Script (AND use the modern notifications framework) would be affected though.

BTT shows some notifications, but these can not be triggered (e.g. when an update is available).

If the script is entered as text I will be able to replace the display notification call with something else internally, to call the new framework.

Ah, ok!

But why does the normal downgrade to version 3.268 not work (without reset the settings in the com.apple.ncprefs.plist) and why are they not requested for version 3.870?

Because macOS stores whether an app is using the modern framework or the old one. If it is registered as modern then old ones do not work anymore and vice versa ;-(
Downgrading doesn't reset the saved framework type of macOS.

Very strange design

Strange!

However, I had reset the settings before running version 3.870. Actually, these should have been asked for. Maybe not, because the notification was not triggered.

3.870 currently can not show notifications through apple script regardless of the configuration. (Because Apple Script tries to go through the legacy framework, but BTT is now using the modern framework).

Let's see, I'll try some workarounds - dynamically replacing the display notification call when executing the Apple Script sounds most promising

Don't bother. There it is easier, I call with do shell script a wrapper process to display the notification.

Thank you very much!
Dirk

I know, but I would like to keep all Apple Script functionality working and it shouldn't be a lot of work. Already working on it right now

1 Like

3.873 alpha now replaces calls to
display notification with

tell application "BetterTouchTool" to display_notification

This takes the exact same arguments as the original "display notification" but uses the new notification framework (on macOS >= 10.14). Also it has an additional parameter "image path" where you can put any file which is then attached to the notification.

tell application "BetterTouchTool" to display_notification "test content" with title "some title" subtitle "subtitle" sound name "frog" image path "/Users/andi/Downloads/download.png"

When using scpt files BTT can not replace it automatically, in such cases you need to manually replace the display notification in your files.

1 Like