• Stars
    star
    135
  • Rank 269,297 (Top 6 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 15 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ruby bindings for libnotify using 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. #21 (comment)

Authors

Contributors

License

MIT License

TODO

More Repositories

1

hashids.cr

A Crystal shard to generate YouTube-like hashes from one or many numbers. Use hashids when you do not want to expose your database ids to the user.
Crystal
52
star
2

minitest-around

Around block for minitest.
Gherkin
41
star
3

hotch

Profile helper
Ruby
28
star
4

libnotify.cr

Libnotify for Crystal
Crystal
26
star
5

dind-example

Docker in docker example
9
star
6

docker-phpmyadmin

Dockerized phpMyAdmin on Alpine
PHP
7
star
7

bigbrother

Server overseer.
Crystal
6
star
8

dotfiles

Personal dotfiles
Python
6
star
9

chrome-feedly-tabs

Open Feedly articles in new tabs.
JavaScript
6
star
10

erl_nif.cr

WIP: Erlang NIF in Crystal
Crystal
6
star
11

ruml

Ruby mailing list software
Ruby
5
star
12

phpmyadmin-backup

Backup DB from phpmyadmin via mechanize
Ruby
5
star
13

shoutcast_api

Simple API for shoutcast.com
Ruby
4
star
14

crystal-ctags

Support for the Crystal language in ctags
4
star
15

ruby-live-for-speed

A Ruby parser for racing game Live for Speed
Ruby
3
star
16

minitest-libnotify

Test notifier for minitest via libnotify.
Ruby
3
star
17

structr

Structure plain text with regexp.
Ruby
2
star
18

firefox-feedly-tabs

Open Feedly articles in new tabs. For Firefox.
JavaScript
2
star
19

services

Ruby
2
star
20

leetplate

Number plate generator (with l337 support)
JavaScript
2
star
21

valuedate

Validates a schema
Ruby
2
star
22

docker-firefox

Dockerized Firefox
Makefile
2
star
23

elm-connect-four

Connect four in elm
Elm
1
star
24

riot_notifier

Notifier for testing framework riot.
Ruby
1
star
25

rouge-lexers-crystal

[DEPRECATED] Rouge's lexer for crystal
Ruby
1
star
26

smstrade_de

Gem for sending SMS via smstrade.de Gateway.
Ruby
1
star
27

dns_checker

Compares domains with root nameserver and your nameserver.
Ruby
1
star
28

optcarrot.cr

Ruby
1
star
29

sloono

Simple SMS API for sloono.de
Ruby
1
star
30

meta_code_commenter

Comments your meta code.
Ruby
1
star