#!/usr/bin/python import glob from lib.powermate import powermate from lib.python_pulse_control.pulsectl import pulsectl INCREASE_AMOUNT = 0.01 class PowerMate(powermate.PowerMateBase): def __init__(self, path): self.pulse = pulsectl.Pulse() super().__init__(path) def rotate(self, rotation): #print(rotation); if (rotation > 0): self.change_vol(INCREASE_AMOUNT) else: self.change_vol(-INCREASE_AMOUNT) def change_vol(self, vol): for sink in self.pulse.sink_list(): #print(sink) self.pulse.volume_change_all_chans(sink, vol) if __name__ == '__main__': pm = PowerMate(glob.glob('/dev/input/by-id/*PowerMate*')[0]) pm.run()