deliveredNotifications (), myNotification ) then if myNotification : activationType () = hs. Since notifications which the user has closed (or cancelled) do not trigger a callback, you can check this table with a timer to see if the user has cleared a notification, e.g. You can use this function along with hs.notify:getFunctionTag to re=register necessary callback functions with hs.notify.register when Hammerspoon is restarted. Only notifications which have been presented but not cleared, either by the user clicking on the hs.notify:otherButtonTitle or through auto-withdrawal (see hs.notify:autoWithdraw for more details), will be in the array returned. a table containing the notification userdata objects for all Hammerspoon notifications currently in the notification center.Returns a table containing notifications which have been delivered. If it evaluates to true, a warning will be displayed to the console indicating that the callback function is missing if it is false, the notification will be silently discarded.įunctions deliveredNotifications Signature any value except false and nil is considered true). If this variable is not set to a function, it will be evaluated as a lua boolean (i.e. If this variable is set to a function, the function will be called with two parameters tag, which will match the tag specified if you used hs.notify.show or a UUID if you used hs.notify.new to define the notification, and notification which will be the notificationObject representing the notification. This occurrence is most common with notifications which are acted upon by the user after Hammerspoon has been reloaded.Ī value indicating whether or not a missing notification function tag should cause a warning. See hs.notify.warnAboutMissingFunctionTag for determining the behavior when a notification attempts to perform a callback to a function tag which is not present in this table.This table has a _tostring metamethod so you can see the list of registered function tags in the console by typing hs.notify.registry.Use the hs.notify.register(tag, fn) and hs.notify.unregister(id) functions. This table should not be modified directly.Use hs.notify:soundName() or set the soundName attribute in hs:notify.new(), to this constant, if you want to use the default soundĪ table containing the registered callback functions and their tags. The string representation of the default notification sound. AdditionalActionClicked - Additional Action selected.ActionButtonClicked - User clicked on Action button.ContentsClicked - User clicked on notification.None - The user has not interacted with the notification.Methods - API calls which can only be made on an object returned by a constructorĪPI Documentation Constants activationTypes SignatureĬonvenience array of the possible activation types for a notification, and their reverse for reference.
0 Comments
Leave a Reply. |