Class: Notifiers::Dunstify
- Inherits:
-
Base
- Object
- Base
- Notifiers::Dunstify
show all
- Defined in:
- lib/notifiers/dunstify.rb
Constant Summary
collapse
- COMMAND =
'dunstify'
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
command?, #image, inherited, #message, #notify, platform?, process?, subclasses, success_process_status?, #title
Class Method Details
.installed? ⇒ Boolean
7
8
9
|
# File 'lib/notifiers/dunstify.rb', line 7
def self.installed?
platform?(/(freebsd|linux)/) and command?(COMMAND)
end
|
Instance Method Details
#action(action_string) ⇒ Object
21
22
23
24
|
# File 'lib/notifiers/dunstify.rb', line 21
def action(action_string)
@action = action_string
self
end
|
#install_instructions ⇒ Object
43
44
45
|
# File 'lib/notifiers/dunstify.rb', line 43
def install_instructions
'dunstify is not installed. Install dunst notification daemon for your distribution.'
end
|
#replace(id) ⇒ Object
26
27
28
29
|
# File 'lib/notifiers/dunstify.rb', line 26
def replace(id)
@replace = id
self
end
|
#timeout(milliseconds) ⇒ Object
16
17
18
19
|
# File 'lib/notifiers/dunstify.rb', line 16
def timeout(milliseconds)
@timeout = milliseconds
self
end
|
#to_s ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/notifiers/dunstify.rb', line 31
def to_s
command = COMMAND.dup
command << " -u '#{@urgency}'" if @urgency
command << " -t '#{@timeout}'" if @timeout
command << " -i '#{@icon}'" if @icon
command << " -r '#{@replace}'" if @replace
command << " -A '#{@action}'" if @action
command << " '#{@title}'" if @title
command << " '#{@message}'" if @message
command
end
|
#urgency(level) ⇒ Object
11
12
13
14
|
# File 'lib/notifiers/dunstify.rb', line 11
def urgency(level)
@urgency = level.to_s
self
end
|