Ruby bindings for libnotify using FFI.
require'libnotify'Libnotify.show(:body=>"hello",:summary=>"world",:timeout=>2.5)require'libnotify'n=Libnotify.newdo |notify|
notify.summary="hello"notify.body="world"notify.timeout=1.5# 1.5 (s), 1000 (ms), "2", nil, falsenotify.urgency=:critical# :low, :normal, :criticalnotify.append=false# default true - append onto existing notificationnotify.transient=true# default false - keep the notifications around after displaynotify.icon_path="/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"endn.show!require'libnotify'# Mixed syntaxoptions={:body=>"world",:timeout=>20}Libnotify.show(options)do |opts|
opts.timeout=1.5# overrides :timeout in optionsendrequire'libnotify'# Icon path auto-detectionLibnotify.icon_dirs << "/usr/share/icons/gnome/*/"Libnotify.show(:icon_path=>"emblem-default.png")Libnotify.show(:icon_path=>:"emblem-default")# Update pre-existing notification then close itn=Libnotify.new(:summary=>"hello",:body=>"world")n.update# identical to show! if not shown beforeKernel.sleep1n.update(:body=>"my love")do |notify|
notify.summary="goodbye"endKernel.sleep1n.closegem install libnotifyYou'll need libnotify. On Debian just type:
apt-get install libnotify1git clone git://github.com/splattael/libnotify.git
cd libnotify
(gem install bundler)
bundle install
rakeCOVERAGE=1 raketimeout and append options might not work on Ubuntu.
See GH #21 for details.
#21 (comment)
- Peter Leitzen (https://github.com/splattael)
- Dennis Collective (https://github.com/denniscollective)
- Daniel Mack (https://github.com/zonque)
- Nuisance of Cats (https://github.com/nuisanceofcats)
- Jason Staten (https://github.com/statianzo)
- Jeremy Lawler (https://github.com/jlawler)
- Kero van Gelder (https://github.com/keroami)
- René Föhring (https://github.com/rrrene)
- Cezary Baginski (https://github.com/e2)
- robisacommonusername (https://github.com/robisacommonusername)
- Fernando Briano (https://github.com/picandocodigo)
Unify show/update interface -> simplifies code
Turn FFI module into a class -> more plugabble
Support newer features of
libnotify-> actions, hints? See https://developer-next.gnome.org/libnotify/0.7/NotifyNotification.htmlSupport older versions of
libnotify-> prior0.4?

