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

I confirm that this new instruction works well under 3.888 version, thanks Andreas!

Not sure if something changed in Ventura, but unfortunately I'm still experiencing this issue. The following executes fine from Script Editor (the second line leads to a BTT notification) but inside BTT I get nothing:

display notification "Test 1"
tell application "BetterTouchTool" to display_notification "Test 2"

Running M1 Pro on Ventura 13.1, BTT version 3.962. Any thoughts what could be causing this?

TIA

you need to give BTT permissions for displaying notifications in system preferences -> notifications. Possibly also disable the grouping feature there

BTT has permissions (see screenshot), and having BTT display a notification through the Mac's Script Editor works (tell application etc). But when running a script in BTT, notifications don't work. Is there a way for me to see any system response/error when executing the script in BTT?

can you list you config in BTT? In general running via the Script Editor triggers the same code as running from within BTT.

You can also try the predefined action „show notification“

To test, I tried the following: move mouse to top left corner triggers predefined "show notification". Nothing happens. I verified that the trigger works with an apple script that does display dialog, this works but no notifications. It's very weird (to me) that the Script Editor is able to make BTT display a notification but nothing inside BTT is able to do the same.

Thanks for your help btw. I realize that debugging this is very tricky...

are you sure the trigger itself is working? (top left corner) does it work with some other action?

Yep, I also ran an Apple Script display a dialog and this runs fine when moving mouse to top left corner.