libnotify 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4a52cc5398098df5fa32b4c995936d9780e8333
4
- data.tar.gz: 0adbe7168d6342b0b425fa235812abee54d31a9b
3
+ metadata.gz: e2bcfd117df48e5384d691c66a805033e0369143
4
+ data.tar.gz: d24ba5860ea43e6a6c788a0886b4df6fdb0f4361
5
5
  SHA512:
6
- metadata.gz: 20b4ec11f7316e75de14d69a8818df4d0dbaf4edc65063c44caf7e1b4144d61ee9c6f878bc4066e070e86c6e4a7f7a74172b105c21655d5edfd09d6604379152
7
- data.tar.gz: a8142295a121e69f3348b96f3a3a4795822ff9d5767ca922220ab28ba906a2deb3cd4e13e756bfd03ddd6ef20234c525b6f54f731d57bd16f5725ab14e82805b
6
+ metadata.gz: 66e36c1c87195c608392f0b70c12736efb87cd7d4ae4e284b36d164be5643da6e17ed95233e54d8e656c64b14ced46e57e78b296a314cec592b8e0929d5733f9
7
+ data.tar.gz: b759bbacff327753c782e6b8263abac997c10aab0e0f276a15399964ddc57e87d04e63d79a8d5ccad5e8428a0369b802668ebd654b68efe7deed883af3b238bf
data/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # Libnotify
2
+
3
+ [![Build Status](https://travis-ci.org/splattael/libnotify.png?branch=master)](https://travis-ci.org/splattael/libnotify) [![Gem Version](https://badge.fury.io/rb/libnotify.png)](http://badge.fury.io/rb/libnotify) [![Code Climate](https://codeclimate.com/github/splattael/libnotify.png)](https://codeclimate.com/github/splattael/libnotify) [![Inline docs](http://inch-pages.github.io/github/splattael/libnotify.png)](http://inch-pages.github.io/github/splattael/libnotify)
4
+
5
+ Ruby bindings for libnotify using FFI.
6
+
7
+ [Gem](https://rubygems.org/gems/libnotify) |
8
+ [Source](https://github.com/splattael/libnotify) |
9
+ [RDoc](http://rubydoc.info/github/splattael/libnotify/master)
10
+
11
+ ![libnotify](http://github.com/splattael/libnotify/raw/master/libnotify.png)
12
+
13
+ ## Usage
14
+
15
+ ```ruby
16
+ require 'libnotify'
17
+
18
+ # Block syntax
19
+ n = Libnotify.new do |notify|
20
+ notify.summary = "hello"
21
+ notify.body = "world"
22
+ notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
23
+ notify.urgency = :critical # :low, :normal, :critical
24
+ notify.append = false # default true - append onto existing notification
25
+ notify.transient = true # default false - keep the notifications around after display
26
+ notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
27
+ end
28
+ n.show!
29
+
30
+ # Hash syntax
31
+ Libnotify.show(:body => "hello", :summary => "world", :timeout => 2.5)
32
+
33
+ # Mixed syntax
34
+ Libnotify.show(options) do |n|
35
+ n.timeout = 1.5 # overrides :timeout in options
36
+ end
37
+
38
+ # Icon path auto-detection
39
+ Libnotify.icon_dirs << "/usr/share/icons/gnome/*/"
40
+ Libnotify.show(:icon_path => "emblem-default.png")
41
+ Libnotify.show(:icon_path => :"emblem-default")
42
+
43
+ # Update pre-existing notification then close it
44
+ n = Libnotify.new(:summary => "hello", :body => "world")
45
+ n.update # identical to show! if not shown before
46
+ Kernel.sleep 1
47
+ n.update(:body => "my love") do |notify|
48
+ notify.summary = "goodbye"
49
+ end
50
+ Kernel.sleep 1
51
+ n.close
52
+ ```
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ gem install libnotify
58
+ ```
59
+
60
+ You'll need libnotify. On Debian just type:
61
+
62
+ ```bash
63
+ apt-get install libnotify1
64
+ ```
65
+
66
+ ## Testing
67
+
68
+ ```bash
69
+ git clone git://github.com/splattael/libnotify.git
70
+ cd libnotify
71
+ (gem install bundler)
72
+ bundle install
73
+ rake
74
+ ```
75
+
76
+ ### Code coverage
77
+
78
+ ```bash
79
+ COVERAGE=1 rake
80
+ ```
81
+
82
+ ## Caveats
83
+
84
+ ### Ubuntu
85
+
86
+ `timeout` and `append` options might not work on Ubuntu.
87
+ See GH #21 for details.
88
+ https://github.com/splattael/libnotify/issues/21#issuecomment-19114127
89
+
90
+ ## Authors
91
+
92
+ * Peter Suschlik (https://github.com/splattael)
93
+
94
+ ## [Contributors](https://github.com/splattael/libnotify/graphs/contributors)
95
+
96
+ * Dennis Collective (https://github.com/denniscollective)
97
+ * Daniel Mack (https://github.com/zonque)
98
+ * Nuisance of Cats (https://github.com/nuisanceofcats)
99
+ * Jason Staten (https://github.com/statianzo)
100
+ * Jeremy Lawler (https://github.com/jlawler)
101
+ * Kero van Gelder (https://github.com/keroami)
102
+ * René Föhring (https://github.com/rrrene)
103
+
104
+ ## License
105
+
106
+ [MIT License](http://www.opensource.org/licenses/MIT)
107
+
108
+ ## TODO
109
+
110
+ * Unify show/update interface
111
+ -> simplifies code
112
+
113
+ * Turn FFI module into a class
114
+ -> more plugabble
115
+
116
+ * Support newer features of `libnotify`
117
+ -> actions, hints?
118
+ See https://developer-next.gnome.org/libnotify/0.7/NotifyNotification.html
119
+
120
+ * Support older versions of `libnotify`
121
+ -> prior `0.4`?
data/lib/libnotify.rb CHANGED
@@ -3,9 +3,9 @@ require 'libnotify/api'
3
3
 
4
4
  # Ruby bindings for libnotify using FFI.
5
5
  #
6
- # See README.rdoc for usage examples.
6
+ # See README.md for usage examples.
7
7
  #
8
- # @see README.rdoc
8
+ # @see README.md
9
9
  # @see Libnotify.new
10
10
  # @author Peter Suschlik
11
11
  module Libnotify
data/lib/libnotify/api.rb CHANGED
@@ -44,32 +44,31 @@ module Libnotify
44
44
  end
45
45
  private :set_defaults
46
46
 
47
- # Shows a notification.
47
+ # Shows a new notification.
48
48
  #
49
49
  # @see Libnotify.show
50
50
  def show!
51
51
  notify_init(self.class.to_s) or raise "notify_init failed"
52
52
  @notification = notify_notification_new(summary, body, icon_path, nil)
53
+ show
54
+ end
55
+
56
+ # Shows an existing notification.
57
+ def show
53
58
  notify_notification_set_urgency(@notification, lookup_urgency(urgency))
54
59
  notify_notification_set_timeout(@notification, timeout || -1)
55
- if append
56
- notify_notification_set_hint_string(@notification, "x-canonical-append", "")
57
- notify_notification_set_hint_string(@notification, "append", "")
58
- end
59
- if transient
60
- notify_notification_set_hint_uint32(@notification, "transient", 1)
61
- end
60
+ set_hints
62
61
  notify_notification_show(@notification, nil)
63
62
  ensure
64
- notify_notification_clear_hints(@notification) if (append || transient)
63
+ clear_hints
65
64
  end
66
65
 
67
- # Updates a previously shown notification.
66
+ # Updates a previously shown notification or creates a new one.
68
67
  def update(options={}, &block)
69
68
  apply_options(options, &block)
70
69
  if @notification
71
70
  notify_notification_update(@notification, summary, body, icon_path, nil)
72
- notify_notification_show(@notification, nil)
71
+ show
73
72
  else
74
73
  show!
75
74
  end
@@ -126,6 +125,20 @@ module Libnotify
126
125
 
127
126
  private
128
127
 
128
+ def set_hints
129
+ if append
130
+ notify_notification_set_hint_string(@notification, "x-canonical-append", "")
131
+ notify_notification_set_hint_string(@notification, "append", "")
132
+ end
133
+ if transient
134
+ notify_notification_set_hint_uint32(@notification, "transient", 1)
135
+ end
136
+ end
137
+
138
+ def clear_hints
139
+ notify_notification_clear_hints(@notification) if (append || transient)
140
+ end
141
+
129
142
  def icon_for(name)
130
143
  IconFinder.new(self.class.icon_dirs).icon_path(name) || name
131
144
  end
@@ -1,3 +1,3 @@
1
1
  module Libnotify
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
data/libnotify.png CHANGED
Binary file
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libnotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Suschlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-04 00:00:00.000000000 Z
11
+ date: 2014-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.11
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.11
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.8.6.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.8.6.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 4.7.4
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.7.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest-libnotify
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.2.2
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.2.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description:
@@ -87,13 +87,12 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .ruby-version
92
- - .simplecov
93
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".simplecov"
92
+ - ".travis.yml"
94
93
  - Gemfile
95
94
  - LICENSE
96
- - README.rdoc
95
+ - README.md
97
96
  - Rakefile
98
97
  - lib/libnotify.rb
99
98
  - lib/libnotify/api.rb
@@ -126,17 +125,17 @@ require_paths:
126
125
  - lib
127
126
  required_ruby_version: !ruby/object:Gem::Requirement
128
127
  requirements:
129
- - - '>='
128
+ - - ">="
130
129
  - !ruby/object:Gem::Version
131
130
  version: '0'
132
131
  required_rubygems_version: !ruby/object:Gem::Requirement
133
132
  requirements:
134
- - - '>='
133
+ - - ">="
135
134
  - !ruby/object:Gem::Version
136
135
  version: '0'
137
136
  requirements: []
138
137
  rubyforge_project:
139
- rubygems_version: 2.0.3
138
+ rubygems_version: 2.2.2
140
139
  signing_key:
141
140
  specification_version: 4
142
141
  summary: Ruby bindings for libnotify using FFI
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.0.0
data/README.rdoc DELETED
@@ -1,96 +0,0 @@
1
- = Libnotify
2
-
3
- {<img src="https://travis-ci.org/splattael/libnotify.png?branch=master" alt="Build Status" />}[https://travis-ci.org/splattael/libnotify] {<img src="https://badge.fury.io/rb/libnotify.png" alt="Gem Version" />}[http://badge.fury.io/rb/libnotify] {<img src="https://codeclimate.com/github/splattael/libnotify.png" />}[https://codeclimate.com/github/splattael/libnotify]
4
-
5
- Ruby bindings for libnotify using FFI.
6
-
7
- Gem[https://rubygems.org/gems/libnotify] |
8
- Source[https://github.com/splattael/libnotify] |
9
- RDoc[http://rubydoc.info/github/splattael/libnotify/master/file/README.rdoc]
10
-
11
- http://github.com/splattael/libnotify/raw/master/libnotify.png
12
-
13
- == Usage
14
-
15
- require 'libnotify'
16
-
17
- # Block syntax
18
- n = Libnotify.new do |notify|
19
- notify.summary = "hello"
20
- notify.body = "world"
21
- notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
22
- notify.urgency = :critical # :low, :normal, :critical
23
- notify.append = false # default true - append onto existing notification
24
- notify.transient = true # default false - keep the notifications around after display
25
- notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
26
- end
27
- n.show!
28
-
29
- # Hash syntax
30
- Libnotify.show(:body => "hello", :summary => "world", :timeout => 2.5)
31
-
32
- # Mixed syntax
33
- Libnotify.show(options) do |n|
34
- n.timeout = 1.5 # overrides :timeout in options
35
- end
36
-
37
- # Icon path auto-detection
38
- Libnotify.icon_dirs << "/usr/share/icons/gnome/*/"
39
- Libnotify.show(:icon_path => "emblem-default.png")
40
- Libnotify.show(:icon_path => :"emblem-default")
41
-
42
- # Update pre-existing notification then close it
43
- n = Libnotify.new(:summary => "hello", :body => "world")
44
- n.update # identical to show! if not shown before
45
- Kernel.sleep 1
46
- n.update(:body => "my love") do |notify|
47
- notify.summary = "goodbye"
48
- end
49
- Kernel.sleep 1
50
- n.close
51
-
52
-
53
- == Installation
54
-
55
- gem install libnotify
56
-
57
- You'll need libnotify. On Debian just type:
58
-
59
- apt-get install libnotify1
60
-
61
- == Testing
62
-
63
- git clone git://github.com/splattael/libnotify.git
64
- cd libnotify
65
- (gem install bundler)
66
- bundle install
67
- rake
68
-
69
- === Code coverage
70
-
71
- COVERAGE=1 rake
72
-
73
- == Caveats
74
-
75
- * +timeout+ and +append+ options might not work on Ubuntu.
76
- See GH #21 for details.
77
- https://github.com/splattael/libnotify/issues/21#issuecomment-19114127
78
-
79
- == Authors
80
-
81
- * Peter Suschlik (https://github.com/splattael)
82
-
83
- == Contributors
84
-
85
- * Dennis Collective (https://github.com/denniscollective)
86
- * Daniel Mack (https://github.com/zonque)
87
- * nuisanceofcats (https://github.com/nuisanceofcats)
88
- * Jason Staten (https://github.com/statianzo)
89
-
90
- == License
91
-
92
- MIT License[http://www.opensource.org/licenses/mit-license.php]
93
-
94
- == TODO
95
-
96
- None.