Module: Volumerb::MacVolume
- Defined in:
- lib/volumerb/mac_volume.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
10 11 12 13 14 |
# File 'lib/volumerb/mac_volume.rb', line 10 def self.down osa 'set currentVolume to output volume of (get volume settings) set volume output volume (currentVolume - 3)' vol end |
.mute ⇒ Object
16 17 18 19 20 21 |
# File 'lib/volumerb/mac_volume.rb', line 16 def self.mute state = osa 'output muted of (get volume settings)' setmute = !eval(state) osa "set volume output muted #{setmute}" vol end |
.osa(script) ⇒ Object
35 36 37 |
# File 'lib/volumerb/mac_volume.rb', line 35 def self.osa(script) `osascript -e '#{script}'` end |
.up ⇒ Object
4 5 6 7 8 |
# File 'lib/volumerb/mac_volume.rb', line 4 def self.up osa 'set currentVolume to output volume of (get volume settings) set volume output volume (currentVolume + 3)' vol end |
.vol ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/volumerb/mac_volume.rb', line 23 def self.vol # Mac OS X output: # output volume:100, input volume:missing value, alert # volume:98, output muted:false vol = osa 'get volume settings' number = vol.match(/output\ volume\:([0-9]+)/)[1] state = vol.match(/muted:([t|f])/)[1] { number: number.to_s, state: state.to_s } end |