Sha256: 8c32b827b3f0553eac37224eb2ad3ee8626ae9399c0e8b49e2c6d463bba0f7f1
Contents?: true
Size: 826 Bytes
Versions: 3
Compression:
Stored size: 826 Bytes
Contents
# coding: utf-8 # module Volume def check_optimal_volume @volume = @current_volume - @current_volume / 10 * @step end def optimize_volume @optimize_volume = ( if @current_volume > @max_volume @max_volume elsif @current_volume < @min_volume @min_volume else @current_volume end ) end def sink_inputs @inputs = `pactl list sink-inputs | grep '№' | grep -o '[0-9]*'`.split("\n") end def change_volume(volume, break_volume, step) change = volume > break_volume ? 'down' : 'up' @inputs.each do |input| loop do system("pactl set-sink-input-volume #{input} '#{volume * 655}'") change == 'up' ? volume += step : volume -= step break if change == 'up' ? volume > break_volume : volume < break_volume end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fest-1.3.12 | lib/fest/volume.rb |
fest-1.3.11 | lib/fest/volume.rb |
fest-1.3.10 | lib/fest/volume.rb |