eufon

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 56a54b4d3134c378df0e8c09c5e5376ea846dcf4
parent 94d5c91c70cf7559c48cf70fba40ac72c8dcaf7e
Author: Daniel Barlow <dan@telent.net>
Date:   Sat, 12 Feb 2022 16:57:08 +0000

send ActionInvoked(default) when widget clicked

Diffstat:
Mcrier/crier.fnl | 29++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/crier/crier.fnl b/crier/crier.fnl @@ -113,13 +113,21 @@ (: :set-body noti.body) (: :set-icon noti.app-icon))) +(fn default-action [id] + (bus.connection:emit_signal + nil ; destination + dbus-service-attrs.path + dbus-service-attrs.interface + "ActionInvoked" + (GV "(us)" [id "default"]))) + (fn make-notification-widget [id] (let [summary (Gtk.Label { :name "summary" }) body (Gtk.Label) icon (Gtk.Image) cancel-me (fn [] (delete-notification id)) event-box (Gtk.EventBox { - :on_button_press_event cancel-me + :on_button_press_event #(default-action id) }) hbox (Gtk.Box { :name "notification" @@ -166,6 +174,12 @@ (update-window) id)) +(fn parse-actions [list] + (let [out {}] + (for [i 1 (# list) 2] + (tset out (. list i) (. list (+ 1 i)))) + out)) + (fn make-notification [params] { :sender (. params 1) @@ -173,7 +187,7 @@ :app-icon (. params 3) :summary (. params 4) :body (. params 5) - :actions (. params 6) + :actions (parse-actions (. params 6)) :hints (. params 7) :timeout (. params 8) }) @@ -183,7 +197,7 @@ (= interface dbus-service-attrs.interface)) (match method "GetCapabilities" - (invocation:return_value (GV "as" ["actions"])) + (invocation:return_value (GV "as" ["actions" "body" "persistence"])) "GetServerInformation" (invocation:return_value @@ -218,4 +232,13 @@ (lgi.GObject.Closure handle-dbus-get) (lgi.GObject.Closure (fn [a] (print "set")))) + +(add-notification { + :app-icon "dialog-information" + :body "This is an example notifiddcation." + :id 3 + :sender "notify-send" + :summary "Hello world!" + }) + (Gtk:main)