Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Lautaro-Garcia/cl-notify
Send notifications to your desktop session
https://github.com/Lautaro-Garcia/cl-notify
common-lisp dbus libnotify lisp
Last synced: about 1 month ago
JSON representation
Send notifications to your desktop session
- Host: GitHub
- URL: https://github.com/Lautaro-Garcia/cl-notify
- Owner: Lautaro-Garcia
- License: gpl-3.0
- Created: 2021-05-24T22:51:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-26T14:55:03.000Z (over 3 years ago)
- Last Synced: 2024-08-02T21:38:38.147Z (5 months ago)
- Topics: common-lisp, dbus, libnotify, lisp
- Language: Common Lisp
- Homepage:
- Size: 23.4 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-stumpwm - cl-notify - Library to send notifications to your desktop through D-Bus (Useful Common Lisp libs)
README
# Show notifications in your desktop
Common lisp library to send notifications to your desktop through D-Bus (kinda as a `libnotify` replacement).
It follows the [Desktop Notification Specification](https://developer.gnome.org/notification-spec)
## Examples
```common-lisp
;; Send a basic notification
(send-notification "Something" :app-name "My application" :timeout-in-millis 10000);; Close notification
(clear *);; Send a notification with actions (buttons)
(send-notification "With buttons" :actions '("id1" "Do this!" "id2" "Do this other thing!"));; Update previous notification to add a body and an urgency level
(update * :body '(:b "If your notification server supports this, this will be bold!")
:hints (list (critical-urgency-hint)));; A more complex body
(send-notification "This is the title"
:app-icon "media-record"
:body '("Look at " (:u "this image ") (:br)
(:img "file://home/user/lisp.png" "Common lisp") (:br)
(:a "https://github.com/Lautaro-Garcia/cl-notify" "click this link to see more info")));; Arbitrary hints (you should check if your implementation actually uses them)
(send-notification "A summary"
:hints (list (make-hint "action-icons" '(:boolean) t))
:actions '("id" "email"))
```## Listen for events (notification closes or buttons were pushed)
```common-lisp
;; The signal handling loop starts in the background when you define a callback.
(define-callback my-callback :action (notification-id action-id)
(format t "The action ~a in the notification ~a was clicked" action-id notification-id))(define-callback my-callback :close (notification-id reason)
(format t "The notification ~a was closed! The reason was ~a" notification-id reason));; You could do the same without using the macro
(register-callback :close 'my-callback
(lambda (notification-id reason)
(format t "The notification ~a was closed! The reason was ~a" notification-id reason))));; You can unregister a callback by its name and type
(unregister-callback :close 'my-callback);; You can stop handling signals (this also deletes every callback)
(stop-signal-handling-loop)
```## Get information about your notification server
```common-lisp
(notification-server-info) ;; => #
(notification-server-capabilities) ;; => ("body" "body-hyperlinks" "body-markup" "body-images" "icon-static" "actions")
```## Requirements
You'll need to have `libfixposix` installed in your system in order to use this library (it's a [dbus](https://github.com/death/dbus) dependency)## Running the tests
```common-lisp
(asdf:test-system :cl-notify)
```## Further documentation
You should probably read the [Desktop Notification Specification](https://developer.gnome.org/notification-spec) if you'd like to know
the actions, signals and values available in this library.