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

* Re: Using libnotify from Guile
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Luis Felipe López Acevedo @ 2016-01-05  0:35 UTC (permalink / raw)
  To: Neil Jerram; +Cc: guile-user

On 2016-01-04 13:26, Neil Jerram wrote:
> 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:

Oh, great Neil! Thank you very much. It works for me :)

-- 
Luis Felipe López Acevedo
http://sirgazil.bitbucket.org/



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

* Re: Using libnotify from Guile
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2016-01-05  9:40 UTC (permalink / raw)
  To: guile-user

Neil Jerram <Neil.Jerram@metaswitch.com> skribis:

> I noticed you asked about libnotify on IRC

Also note that glibc built for the Linux kernel provides wrappers for a
bunch of inotify syscalls in <sys/inotify.h>:

--8<---------------cut here---------------start------------->8---
$ objdump -T .guix-profile/lib/libc.so.6 | grep inotify
00000000000e9cc0 g    DF .text  0000000000000021  GLIBC_2.9   inotify_init1
00000000000e9cf0 g    DF .text  0000000000000021  GLIBC_2.4   inotify_rm_watch
00000000000e9c90 g    DF .text  0000000000000021  GLIBC_2.4   inotify_init
00000000000e9c60 g    DF .text  0000000000000021  GLIBC_2.4   inotify_add_watch
--8<---------------cut here---------------end--------------->8---

So you could avoid libnotify altogether with things like:

  (dynamic-func "inotify_init" (dynamic-link))

Ludo’.




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

* Re: Using libnotify from Guile
  2016-01-05  9:40 ` Ludovic Courtès
@ 2016-01-05 10:07   ` Neil Jerram
  2016-01-05 20:22     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Jerram @ 2016-01-05 10:07 UTC (permalink / raw)
  To: guile-user

On 05/01/16 09:40, Ludovic Courtès wrote:
> Neil Jerram <Neil.Jerram@metaswitch.com> skribis:
>
>> I noticed you asked about libnotify on IRC
>
> Also note that glibc built for the Linux kernel provides wrappers for a
> bunch of inotify syscalls in <sys/inotify.h>:
>
> --8<---------------cut here---------------start------------->8---
> $ objdump -T .guix-profile/lib/libc.so.6 | grep inotify
> 00000000000e9cc0 g    DF .text  0000000000000021  GLIBC_2.9   inotify_init1
> 00000000000e9cf0 g    DF .text  0000000000000021  GLIBC_2.4   inotify_rm_watch
> 00000000000e9c90 g    DF .text  0000000000000021  GLIBC_2.4   inotify_init
> 00000000000e9c60 g    DF .text  0000000000000021  GLIBC_2.4   inotify_add_watch
> --8<---------------cut here---------------end--------------->8---
>
> So you could avoid libnotify altogether with things like:
>
>    (dynamic-func "inotify_init" (dynamic-link))
>
> Ludo’.
>
>

But isn't inotify (a Linux kernel subsystem for noticing changes to the 
filesystem) unrelated to libnotify (a thing for popping up a 
notification message on the desktop)?



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

* Re: Using libnotify from Guile
  2016-01-05 10:07   ` Neil Jerram
@ 2016-01-05 20:22     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2016-01-05 20:22 UTC (permalink / raw)
  To: guile-user

Neil Jerram <neil@ossau.homelinux.net> skribis:

> But isn't inotify (a Linux kernel subsystem for noticing changes to
> the filesystem) unrelated to libnotify (a thing for popping up a
> notification message on the desktop)?

Oh!  Indeed, my bad.  Well, thanks for notifying me!  :-)

Ludo’.




^ 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).