Module: Volumerb::LinuxVolume

Defined in:
lib/volumerb/linux_volume.rb

Class Method Summary collapse

Class Method Details

.downObject



9
10
11
12
# File 'lib/volumerb/linux_volume.rb', line 9

def self.down
  `amixer -q sset Master 3%-`
  vol
end

.muteObject



14
15
16
17
# File 'lib/volumerb/linux_volume.rb', line 14

def self.mute
  `amixer sset Master toggle`
  vol
end

.upObject



4
5
6
7
# File 'lib/volumerb/linux_volume.rb', line 4

def self.up
  `amixer -q sset Master 3%+`
  vol
end

.volObject



19
20
21
22
23
24
# File 'lib/volumerb/linux_volume.rb', line 19

def self.vol
  vol = `amixer get Master | grep "\[[0-9]*%\]\ \[o[n|f]"`
  number = vol.match(/([0-9]+)%/)[1]
  state = vol.match(/\[([a-z]+)\]/)[1]
  { value: number.to_i, state: state.to_s }
end