[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using libnotify from Guile
From: |
Neil Jerram |
Subject: |
Using libnotify from Guile |
Date: |
Mon, 4 Jan 2016 18:26:24 +0000 |
Hi Luis,
I noticed you asked about libnotify on IRC; unfortunately I wasn't quick
enough before you left the channel, but I had a quick play and found
that it was quite easy to generate a notification using the FFI:
(use-modules (system foreign))
(define libnotify (dynamic-link "libnotify"))
(define notify-init
(pointer->procedure int
(dynamic-func "notify_init" libnotify)
(list '*)))
(notify-init (string->pointer "notify.scm"))
(define notify-notification-new
(pointer->procedure '*
(dynamic-func "notify_notification_new" libnotify)
(list '* ; summary
'* ; body
'* ; icon
)))
(define notify-notification-show
(pointer->procedure int
(dynamic-func "notify_notification_show" libnotify)
(list '* ; notification
'* ; &error
)))
(notify-notification-show (notify-notification-new (string->pointer
"Hello!")
(string->pointer "Pleased to meet you")
%null-pointer)
%null-pointer)
I thought you might like that; note that you'll also need "aptitude
install libnotify-dev", or your system's equivalent.
Regards,
Neil
- Using libnotify from Guile,
Neil Jerram <=