commit
5082aaae0c
5 changed files with 44 additions and 0 deletions
@ -0,0 +1,6 @@ |
|||||||
|
[submodule "lib/powermate"] |
||||||
|
path = lib/powermate |
||||||
|
url = https://github.com/bethebunny/powermate |
||||||
|
[submodule "lib/python_pulse_control"] |
||||||
|
path = lib/python_pulse_control |
||||||
|
url = https://github.com/mk-fg/python-pulse-control |
||||||
@ -0,0 +1,35 @@ |
|||||||
|
#!/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() |
||||||
Loading…
Reference in new issue