vjeantet / alerter Goto Github PK
View Code? Open in Web Editor NEWSend User Alert Notification on Mac OS X from the command-line.
License: MIT License
Send User Alert Notification on Mac OS X from the command-line.
License: MIT License
V3 - Doesn't work in macOS Big Sur
While it is test system, but it is worth reflecting.
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.
is it possible to have the option to remove these buttons. the only option i see are to change the labels.
the original project https://github.com/julienXX/terminal-notifier defaults to this if you activate a simple terminal-notifier -message "test"
but adding more things causes the buttons to show
I have a problem similar to #27
On Mojave everything is working as expected, but on Big Sur some notifications just hang when I'm using the -sender
parameter.
If I send as com.apple.TextEdit
, it just works, but when I'm trying with com.microsoft.Outlook
it just hangs and never gets anywhere.
Example:
alerter -message "Hi there" -title "This is awesome" -sender "com.microsoft.outlook"
This is on Big Sur 11.2.1, with Outlook 16.46 and I've tried both the precompiled version of alerter, an earlier version of alerter and I even downloaded the project and compiled it myself. Still no luck.
I can see in the Console.app that when it hangs, the NotificationCenter never gets the call, instead I see messages of this nature:
error 13:43:48.541532+0100 usernoted Legacy client com.microsoft.Outlook connecting to modern client. You can't mix modern clients with legacy clients. <ClientConnect: 0x000000014b133200 identifier: com.microsoft.Outlook pid: 37218 type: Application>
error 13:43:48.541897+0100 usernoted Denying message 3 from connection
error 13:44:07.695655+0100 usernoted Denying message 7 from connection
Let me know if you need more information or if I should try something else.
Hi - Love your app by the way.
Do you intend it to support macOS Catalina?
Seeing an issue - SSoftLinking - The function 'SLSIsSuppressedByScreenTime' can't be found in the (null) framework.
Would anyone familiar with making Macports ports be interested in adding one for this? It's a very useful utility and terminal-notifier is available via Macports. I know there was an attempt to merge the two utilities but it seems to have stalled for now?
Anyway, a Macports port would be really useful.
Sorry, I know this will seem insanely simple but would it be possible to add a tiny install section?
...
[Download](...#)
Prebuilt binaries are available from the releases section.
# Installation
...
# Usage
..
In macOS 10.15.7, an Alerter process stays running if the user refuses permission for Alerter to send notifications. Same if user chooses "None" in notification style. I have found a large number of Alerter processes running which have to be killed in Activity Monitor (or I guess by logging off).
Can Alerter be updated so that it kills its own process when user refuses permission ? It does that if the notification is displayed but not if the Notification is not displayed.
Thanks.
When running this command:
/usr/local/bin/alerter -message Msg -title title -subtitle subtitle -closeLabel close_label -dropdownlabel drop -actions one,two,three -json -timeout 10
action list in the notification contains Show
item, clicking it leads to exception:
2021-11-19 23:53:54.519 alerter[58872:14756858] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndexedSubscript:]: index 9223372036854775807 beyond bounds [0 .. 2]'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2066f1db __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff203a8d92 objc_exception_throw + 48
2 CoreFoundation 0x00007fff20725e0a _CFThrowFormattedException + 202
3 CoreFoundation 0x00007fff205e3140 +[NSNull null] + 0
4 alerter 0x000000010ae176e5 -[AppDelegate userNotificationCenter:didActivateNotification:] + 540
5 Foundation 0x00007fff2142bf63 -[_NSConcreteUserNotificationCenter _sendDelegateMessage:sendToAppDelegate:withObject:] + 118
6 Foundation 0x00007fff215e891a -[_NSConcreteUserNotificationCenter _notificationClickedMessage:] + 460
7 Foundation 0x00007fff213de9b2 __54-[_NSConcreteUserNotificationCenter _serverConnection]_block_invoke_4 + 49
8 libdispatch.dylib 0x00007fff20352623 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x00007fff20353806 _dispatch_client_callout + 8
10 libdispatch.dylib 0x00007fff2035fb4f _dispatch_main_queue_callback_4CF + 940
11 CoreFoundation 0x00007fff20631f18 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
12 CoreFoundation 0x00007fff205f4112 __CFRunLoopRun + 2755
13 CoreFoundation 0x00007fff205f2f8c CFRunLoopRunSpecific + 563
14 HIToolbox 0x00007fff2883aa83 RunCurrentEventLoopInMode + 292
15 HIToolbox 0x00007fff2883a7e5 ReceiveNextEventCommon + 587
16 HIToolbox 0x00007fff2883a583 _BlockUntilNextEventMatchingListInModeWithFilter + 70
17 AppKit 0x00007fff22dfc172 _DPSNextEvent + 864
18 AppKit 0x00007fff22dfa945 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1364
19 AppKit 0x00007fff22decc69 -[NSApplication run] + 586
20 alerter 0x000000010ae1882a main + 147
21 libdyld.dylib 0x00007fff20518f3d start + 1
)
libc++abi: terminating with uncaught exception of type NSException
I randomly saw the var substitution/str interpolation template in a few places when using the latest binary, alerter_v004_darwin_amd64.zip
:
I didn't actually go looking for this, so it's possible there are other places where this var needs to be subbed.
I was wondering why, when we specify -appIcon we still have the Terminal icon as if it was the first character of the title.
as in the third screenshot in your documentation.
How to, if I want to get rid of this small icon ?
macOS 10.15.6, alerter v1.1.0
after approval in Notification Center, the entry in the sqlite db is:
fr.sodadi.${product_name:rfc1034identifier}
am I having to repeatedly approve alerter b/c there is no app name in the bundle ID?
I just executed the 1.0.0 version downloaded directly from the release page, and here's the output:
When I run the alerter command (release 003) on MacOS 10.15 it doesn't throw any errors but the notification never appears and the execution of the alerter command never returns.
I previously ran it (release 002) on MacOS 10.14 without issues.
Is it possible to get a 'reply' style alert, (with a text entry field), without first having to have the notification ask if you would like to reply?
Thanks -Kevin
do:
alerter -message "One" -timeout 30 &
and then a bit later:
alerter -message "Two" &
results to:
@TIMEOUT@CLOSED
and only the last one, if you would do this with three or more or multiple message with timeouts, only the last one gets closed as well. That would not be such a big problem, unless you would await a actual user feedback
With either a file path or URL, no icon is displayed. This tested on Big Sur 11.3. Will try again shortly on 11.4.
Hi, I'm running into an issue with alerter on 11.4 clients perhaps because the app is not notarized? I've tried packaging it using Composer and signing the installer package with a Developer ID certificate but when it's run I get the prompt "alerter" can't be opened because Apple cannot check it for malicious software.
Can we get native apple silicon support?
Would be great to simply brew install alerter
this is fairly straight forward.
How to do a simple notification, i.e. without buttons ?
Thanks
V.
Hello! Thanks for your product, this that that I looked for. The problem if to leave windows in "Notices", occurs leakage of memory. In 12 hours lost 10GB.
Mac os 10.14.3 system
Excuse for bad English)))
I am issuing calls to Alerter from AppleScript using "do shell script" which uses the "sh" shell.
I want an alert to remain visible until removed by my app. I first tried working with a specific ID. But, that did not remove the alert.
Must the "ID" be a Bundle ID or can it be any text ?
I tried the "-remove ALL" option which worked but, after removing the alert, another alert is shown.
Is there a way to prevent the second alert showing ?
Thanks.
Hello.
Homebrew maintainer. alerter
1.0.1 fails to build on macOS Ventura.
Here is the error:
==> xcodebuild -arch x86_64 -project alerter.xcodeproj -target alerter -configuration Release SYMROOT=build
2023-04-05 18:59:20.974 xcodebuild[7583:8256001] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -arch x86_64 -project alerter.xcodeproj -target alerter -configuration Release SYMROOT=build
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
ARCHS = x86_64
SYMROOT = build
2023-04-05 18:59:20.985 xcodebuild[7583:8256009] DVTErrorPresenter: Unable to load simulator devices.
Domain: DVTCoreSimulatorAdditionsErrorDomain
Code: 3
Failure Reason: The version of the CoreSimulator framework installed on this Mac is out-of-date and not supported by this version of Xcode.
Recovery Suggestion: Please ensure that you have installed all available updates to your Mac's software, and that you are running the most recent version of Xcode supported by macOS.
--
CoreSimulator is out of date. Current version (857.7.0) is older than build version (885.2.0).
Domain: DVTCoreSimulatorAdditionsErrorDomain
Code: 3
--
2023-04-05 18:59:20.985 xcodebuild[7583:8256009] iOSSimulator: [SimServiceContext sharedServiceContextForDeveloperDir:error:] returned nil (Error Domain=DVTCoreSimulatorAdditionsErrorDomain Code=3 "CoreSimulator is out of date. Current version (857.7.0) is older than build version (885.2.0)." UserInfo={NSLocalizedDescription=CoreSimulator is out of date. Current version (857.7.0) is older than build version (885.2.0).}). Simulator device support disabled.
2023-04-05 18:59:21.357 xcodebuild[7583:8256009] NetworkStorageDB:_openDBReadConnections: failed to open read connection to DB @ /Users/michkapopoff/Library/Caches/com.apple.dt.xcodebuild/Cache.db. Error=14. Cause=unable to open database file
2023-04-05 18:59:21.357 xcodebuild[7583:8256009] The read-connection to the DB=/Users/michkapopoff/Library/Caches/com.apple.dt.xcodebuild/Cache.db is NOT valid. Unable to determine schema version.
2023-04-05 18:59:21.357 xcodebuild[7583:8256009] NetworkStorageDB:_openDBWriteConnections: failed to open write connection to DB @ /Users/michkapopoff/Library/Caches/com.apple.dt.xcodebuild/Cache.db. Error=14. Cause=unable to open database file
2023-04-05 18:59:21.357 xcodebuild[7583:8256009] DEBUG: there is no SQL cache DB located at /Users/michkapopoff/Library/Caches/com.apple.dt.xcodebuild/Cache.db.
2023-04-05 18:59:21.357 xcodebuild[7583:8256009] DEBUG: there is no SQL cache DB located at /Users/michkapopoff/Library/Caches/com.apple.dt.xcodebuild/Cache.db-shm.
2023-04-05 18:59:21.357 xcodebuild[7583:8256009] DEBUG: there is no SQL cache DB located at /Users/michkapopoff/Library/Caches/com.apple.dt.xcodebuild/Cache.db-wal.
2023-04-05 18:59:21.358 xcodebuild[7583:8256008] writeDBwithCachedResponse-ERROR: (_dbWriteConnection=0x7f7aa1c38fb0) insert SQL stmnt. is nil for storage: /Users/michkapopoff/Library/Caches/com.apple.dt.xcodebuild
Computing target dependency graph and provisioning inputs
Create build description
Build description signature: aba58688310f63c2bb7ae292a2f307b1
Build description path: /tmp/alerter-20230405-7543-1kuo9i4/alerter-1.0.1/build/XCBuildData/aba58688310f63c2bb7ae292a2f307b1.xcbuilddata
warning: Building targets in manual order is deprecated - check "Parallelize build for command-line builds" in the project editor, or set DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING in any of the targets in the current build to suppress this warning
/tmp/alerter-20230405-7543-1kuo9i4/alerter-1.0.1/alerter.xcodeproj: error: No signing certificate "Mac Development" found: No "Mac Development" signing certificate matching team ID "NQLLJK2GK3" with a private key was found. (in target 'alerter' from project 'alerter')
Could you help us with this to be able to update the package?
Hi,
I'm trying to trigger a notification from inside a bash script, however I do not want the script to wait for a user to click on the notification. I want the script to fire the notification and then continue on to the next line.
I haven't been able to find a way to achieve this by going through the help message of the command - The closest solution I could find was to use the timeout
flag, which still causes the script to be blocked for that many seconds.
Can someone please point me in the right direction?
Love the app like so many. Any chance you can make it supportable in 10.15?
Doesn't work on latest beta build 19A558d
In case of terminal-notifier, one can mouse over the notification to prevent from disappearing but this doesn't work with alerter! any solution?
i get nothing when i do echo 'Hello World!' | alerter -sound default alerter is in my $PATH also. echo doesn't return to prompt simply stays there like its waiting for something. no notifications pop up.
Hi!
It would be great to have a version option to allow for easier auto-update scripting.
Thanks a lot.
When I try to specify Dropbox as -sender
like this:
alerter \
-sender com.getdropbox.dropbox \
-message 'Launch Dropbox ?' \
-closeLabel No \
-actions 'Launch' \
-timeout 30
The alert does not appear, and the timeout does not happen.
If I remove the -sender
line, it works.
If I use -sender com.apple.TextEdit
instead, it works.
This is using alerter (1.1.0)
on latest Catalina non-beta:
ProductName: Mac OS X
ProductVersion: 10.15.4
BuildVersion: 19E266
The readme info on _Alerter _ says:
Because of this it is important to note that you cannot combine this with options like -execute , -open , and -activate which depend on the sender of the notification to be ‘alerter’ to perform its work.
But, I can't find any detail on what -execute , -open , and -activate do. I've played with adding them to my Alerter call (e.g. -open "/System/Applications/TextEdit.app"). but nothing happens.
I can't find any reference to them in the code so, are they planned for the future ?
Thanks.
This works fine:
alerter -message "Choose pill" -actions "Blue","Red" -dropdownLabel "Colour" -closeLabel "No Thanks" -json
but the moment you do not pass -closeLabel
(with the label string), then only the 'dropdown' button appears and when you click on it, you get a complete stack trace plus Abort trap: 6
Sorry to post this if it doesn't belong here, but...
I saw the release of 2.0.0 of terminal-notifier, and that they removed some of the features I was using (json response + actions). So it's suggested to use this project instead. However I see the last release was in 2015, so I am not sure what issues it has or if it's being updated etc. and I have a lot of scripts already written that depend on terminal-notifier.
Should we be using this instead? What are the issues that Julien was referring to? Any additional info would be greatly appreciated. Thanks
Is it possible to set the time at which the alert will be displayed? What I want to do is schedule reminder alerts. Ideally, it would be possible to trigger the alerts with something like the unix program remind.
'NSUserNotification' is deprecated: first deprecated in macOS 11.0 - All NSUserNotifications API should be replaced with UserNotifications.frameworks API.
And today, some options are no more relevant, like the close button, as it was removed by apple in recent MacOS..
Could you add an option that lets the user click the dropdown actions without closing the dialog, ie. the dialog must be explicitly closed with the "Close" button.
-sticky Don't remove notification until user explicitly touches the "Close" button
Using
$ alerter --help
returns in first line
${EXECUTABLE_NAME} (1.0.0) is a command-line tool to send OS X User Notifications.
Seems that an macro expansion does not work well…
Running /usr/bin/local/alerter
without options led to a crash and the error
dyld: cannot load 'alerter' (load command 0x80000034 is unknown)
Abort trap: 6
Earlier, the command /usr/bin/local/alerter -h
spurred kernel panic.
Is the binary compatible with macOS 10.14? The description says it's designed to work with 10.8+, however, on my 10.9 machine it returns the same error.
Is there any way for alerter to remain in the background when then notification shows?
I tried with or without -timeout or -group, setting alerter as banner or notifications, telling System Pref to keep 20 notifications from alerter, nothing works, notifications are disappearing from notification center as soon as they're added (I'm in 10.11 El Capitan).
Is that a normal behavior ?
Option could be -placeholder 'Some example text'
Upon clicking "reply", would show a grayed out text in input box offering user an example of what to write (instead of the present implementation which just shows "Reply"). When clicked into, the gray text disappears.
I'm trying the latest binary from GitHub on Bigsur 11.0.1 and it seems to hang on the terminal until I press ctrl+c - no message displayed. Anything I can do?
Is it just me or when the alerter notification slide in, you can not see the buttons right away , but now to click the little "options" first to see available other buttons?
before it was possible to see buttons right away when it did slide in
I've downloaded your latest version of alerter, but when a run it under Mojave I get the following errors:
./alerter -message "Deploy the canons"
dyld: lazy symbol binding failed: Symbol not found: _objc_opt_new
Referenced from: /Users/stre/Downloads/./alerter (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libobjc.A.dylibdyld: Symbol not found: _objc_opt_new
Referenced from: /Users/stre/Downloads/./alerter (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libobjc.A.dylibAbort trap: 6
If I download and run v002 everything works as expected.
Just rebuilt my Mac, did a git clone plus downloaded the executable which I placed in /usr/local/bin and it does issue a alert notification, but I'm not finding the app in the notification settings .. Any idea on how to fix this?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.