Module: Notifier::Tmux

Extended by:
Tmux
Included in:
Tmux
Defined in:
lib/git/background/notifier_ext/tmux.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.which?(cmd) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/git/background/notifier_ext/tmux.rb', line 7

def self.which? cmd
  dir = ENV['PATH'].split(':').find {|p| File.executable? File.join(p, cmd)}
  File.join(dir, cmd) unless dir.nil?
end

Instance Method Details

#notify(options) ⇒ Object



16
17
18
# File 'lib/git/background/notifier_ext/tmux.rb', line 16

def notify(options)
  `tmux display-message '[#{options[:title]}] #{options[:message]}'`
end

#supported?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/git/background/notifier_ext/tmux.rb', line 12

def supported?
  self.which?('tmux') && ! `tmux ls 2>/dev/null`.empty?
end