Skip to content

Repository files navigation

Libnotify

Build StatusGem VersionCode ClimateInline docs

Ruby bindings for libnotify using FFI.

Gem | Source | RDoc

libnotify

Usage

require'libnotify'# Block syntaxn=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!# Hash syntaxLibnotify.show(:body=>"hello",:summary=>"world",:timeout=>2.5)# Mixed syntaxLibnotify.show(options)do |n|
n.timeout=1.5# overrides :timeout in optionsend# 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.close

Installation

gem install libnotify

You'll need libnotify. On Debian just type:

apt-get install libnotify1

Testing

git clone git://github.com/splattael/libnotify.git
cd libnotify
(gem install bundler)
bundle install
rake

Code coverage

COVERAGE=1 rake

Caveats

Ubuntu

timeout and append options might not work on Ubuntu. See GH #21 for details. splattael#21 (comment)

Authors

Contributors

License

MIT License

TODO

About

Ruby bindings for libnotify using FFI.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors