unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Using libnotify from Guile
@ 2016-01-04 18:26 Neil Jerram
  2016-01-05  0:35 ` Luis Felipe López Acevedo
  2016-01-05  9:40 ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Neil Jerram @ 2016-01-04 18:26 UTC (permalink / raw)
  To: Luis Felipe López Acevedo; +Cc: guile-user@gnu.org

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-05 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-04 18:26 Using libnotify from Guile Neil Jerram
2016-01-05  0:35 ` Luis Felipe López Acevedo
2016-01-05  9:40 ` Ludovic Courtès
2016-01-05 10:07   ` Neil Jerram
2016-01-05 20:22     ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).