Class: Cejo::Ops::SoundManager
- Inherits:
-
Object
- Object
- Cejo::Ops::SoundManager
- Defined in:
- lib/cejo/ops/volume/sound_manager.rb
Overview
Sound manager information
Defined Under Namespace
Classes: ALL
Instance Attribute Summary collapse
-
#utils ⇒ Object
readonly
Returns the value of attribute utils.
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize(utils) ⇒ SoundManager
constructor
A new instance of SoundManager.
-
#pactl_sink ⇒ Object
Find the running Pactl sink.
- #sink ⇒ Object
- #sound_manager ⇒ Object
- #sound_managers ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(utils) ⇒ SoundManager
Returns a new instance of SoundManager.
9 10 11 |
# File 'lib/cejo/ops/volume/sound_manager.rb', line 9 def initialize(utils) @utils = utils end |
Instance Attribute Details
#utils ⇒ Object (readonly)
Returns the value of attribute utils.
7 8 9 |
# File 'lib/cejo/ops/volume/sound_manager.rb', line 7 def utils @utils end |
Instance Method Details
#info ⇒ Object
36 37 38 |
# File 'lib/cejo/ops/volume/sound_manager.rb', line 36 def info ALL.new(sound_manager, sink[sound_manager]) end |
#pactl_sink ⇒ Object
Find the running Pactl sink
14 15 16 17 18 19 |
# File 'lib/cejo/ops/volume/sound_manager.rb', line 14 def pactl_sink `pactl list sinks`.split('Sink #').each do |sink| sink_id = sink[0] return sink_id if sink.include? 'State: RUNNING' end end |
#sink ⇒ Object
21 22 23 24 25 |
# File 'lib/cejo/ops/volume/sound_manager.rb', line 21 def sink { pactl: pactl_sink } end |
#sound_manager ⇒ Object
31 32 33 |
# File 'lib/cejo/ops/volume/sound_manager.rb', line 31 def sound_manager sound_managers.first { |manager| utils.which?(manager) }.to_sym end |
#sound_managers ⇒ Object
27 28 29 |
# File 'lib/cejo/ops/volume/sound_manager.rb', line 27 def sound_managers %w[pactl amixer mixer] end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/cejo/ops/volume/sound_manager.rb', line 40 def to_s "#{sound_manager} #{sink}" end |