vjeantet / alerter

Send User Alert Notification on Mac OS X from the command-line.
MIT License
936 stars 62 forks source link

"timeout" parameter not working on multiple alerts #47

Open section83 opened 2 years ago

section83 commented 2 years ago

The "timeout" parameter for Alerter doesn't work properly when multiple alerts are displayed at the same time in separate processes. For example, if 3 alerts are displayed, one will close normally but the other 2 will remain displayed until closed by the user. Clicking on the body of any alert does nothing. Only way to close these alerts is to click on the "Close" button.

AppleScript code used for testing:

use AppleScript version "2.4" use scripting additions set alerterPath to quoted form of (POSIX path of "Macintosh HD:Users:Home:alerter") do shell script alerterPath & " -message 'Test1' -title 'Testing' -subtitle 'Subtitle' -timeout 10 -sender com.apple.script.id.MyApplet -actions '_' > /dev/null 2> /dev/null & " do shell script alerterPath & " -message 'Test2' -title 'Testing' -subtitle 'Subtitle' -timeout 10 -sender com.apple.script.id.MyApplet -actions '_' > /dev/null 2> /dev/null & " do shell script alerterPath & " -message 'Test3' -title 'Testing' -subtitle 'Subtitle' -timeout 10 -sender com.apple.script.id.MyApplet -actions '_' > /dev/null 2> /dev/null & "

I have found this behaviour in macOS 12.2, 10.15, 10.14, 10.13 and 10.12.

It also occurs in macOS 12.2 but there's an additional problem in that, at first, the alerts almost completely overlap. But, when the body of he top alert is clicked, they rearrange and display correctly. But, then, they don't close.

This behaviour also occurs if the sender parameter is omitted.

Also, sometimes, the alerts show in the wrong order e.g. Test1, Test3, Test2.

Fixes for this would be great.