All Projects → splattael → Libnotify

splattael / Libnotify

Licence: mit
Ruby bindings for libnotify using FFI.

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Libnotify

Hcwiid
Haskell binding for CWiid (wiimote)
Stars: ✭ 7 (-94.93%)
Mutual labels:  ffi
Koreader Base
Base framework offering a Lua scriptable environment for creating document readers
Stars: ✭ 81 (-41.3%)
Mutual labels:  ffi
Lzmq
Lua binding to ZeroMQ
Stars: ✭ 110 (-20.29%)
Mutual labels:  ffi
Rust V8worker2
Minimal Rust binding to V8 (based on ry/libv8worker2)
Stars: ✭ 33 (-76.09%)
Mutual labels:  ffi
Ffi Platypus
Write Perl bindings to non-Perl libraries with FFI. No XS required.
Stars: ✭ 80 (-42.03%)
Mutual labels:  ffi
Erlang nif Sys
Low level bindings to Erlang NIF API for Rust
Stars: ✭ 84 (-39.13%)
Mutual labels:  ffi
Rust Python Example
Example of using Rust to Extend Python
Stars: ✭ 699 (+406.52%)
Mutual labels:  ffi
Tflite native
A Dart interface to TensorFlow Lite (tflite) through dart:ffi
Stars: ✭ 120 (-13.04%)
Mutual labels:  ffi
Winapi Rs
Rust bindings to Windows API
Stars: ✭ 1,237 (+796.38%)
Mutual labels:  ffi
Derry
A script manager for Dart.
Stars: ✭ 107 (-22.46%)
Mutual labels:  ffi
Rucaja
Calling the JVM from Rust via JNI
Stars: ✭ 35 (-74.64%)
Mutual labels:  ffi
Fruity
Rusty bindings for Apple libraries
Stars: ✭ 72 (-47.83%)
Mutual labels:  ffi
Ffi Convert Rs
Easier and safer interface between Rust, C, and other languages
Stars: ✭ 86 (-37.68%)
Mutual labels:  ffi
Zion
A statically-typed strictly-evaluated garbage-collected readable programming language.
Stars: ✭ 33 (-76.09%)
Mutual labels:  ffi
Fficxx
Haskell-C++ Foreign Function Interface Generator
Stars: ✭ 117 (-15.22%)
Mutual labels:  ffi
Php Ffi Examples
Runnable examples to learn how PHP FFI works
Stars: ✭ 26 (-81.16%)
Mutual labels:  ffi
Realm Dart Ffi
Experimental Realm binding using dart:ffi preview support
Stars: ✭ 83 (-39.86%)
Mutual labels:  ffi
Ffi Navigator
Stars: ✭ 122 (-11.59%)
Mutual labels:  ffi
Swift Haskell Tutorial
Integrating Haskell with Swift Mac Apps
Stars: ✭ 118 (-14.49%)
Mutual labels:  ffi
Android Luajit Launcher
Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI
Stars: ✭ 87 (-36.96%)
Mutual labels:  ffi

Libnotify

Build Status Gem Version Code Climate Inline docs

Ruby bindings for libnotify using FFI.

Gem | Source | RDoc

libnotify libnotify

Usage

Hash Syntax

require 'libnotify'
Libnotify.show(:body => "hello", :summary => "world", :timeout => 2.5)

Block Syntax

require 'libnotify'

n = Libnotify.new do |notify|
  notify.summary    = "hello"
  notify.body       = "world"
  notify.timeout    = 1.5         # 1.5 (s), 1000 (ms), "2", nil, false
  notify.urgency    = :critical   # :low, :normal, :critical
  notify.append     = false       # default true - append onto existing notification
  notify.transient  = true        # default false - keep the notifications around after display
  notify.icon_path  = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
end

n.show!

Mixed Syntax

require 'libnotify'

# Mixed syntax
options = {:body => "world", :timeout => 20}
Libnotify.show(options) do |opts|
  opts.timeout = 1.5     # overrides :timeout in options
end

Managing Icon Paths

require 'libnotify'

# Icon path auto-detection
Libnotify.icon_dirs << "/usr/share/icons/gnome/*/"
Libnotify.show(:icon_path => "emblem-default.png")
Libnotify.show(:icon_path => :"emblem-default")

Updating existing notification and closing it

# Update pre-existing notification then close it
n = Libnotify.new(:summary => "hello", :body => "world")
n.update # identical to show! if not shown before

Kernel.sleep 1

n.update(:body => "my love") do |notify|
  notify.summary = "goodbye"
end

Kernel.sleep 1

n.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. https://github.com/splattael/libnotify/issues/21#issuecomment-19114127

Authors

Contributors

License

MIT License

TODO

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].