Skip to content

Commit

Permalink
fixed get_brightness for multiple displays
Browse files Browse the repository at this point in the history
issue #14 
resolved : TypeError: unsupported operand type(s) for /: 'float' and 'list'

get_brightness() returns a list if multiple displays are detected,
To fix this pass display=0 to get_brightness().
i.e. : sbcontrol.get_brightness(display=0)
  • Loading branch information
ankit-4129 committed May 29, 2022
1 parent d99f4bc commit a275d9d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Gesture_Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,13 @@ def getpinchxlv(hand_result):

def changesystembrightness():
"""sets system brightness based on 'Controller.pinchlv'."""
currentBrightnessLv = sbcontrol.get_brightness()/100.0
currentBrightnessLv = sbcontrol.get_brightness(display=0)/100.0

This comment has been minimized.

Copy link
@cvs777

cvs777 Jan 10, 2023

currentBrightnessLv = sbcontrol.get_brightness(display=0)[-1]/100.0 this can fix that error

currentBrightnessLv += Controller.pinchlv/50.0
if currentBrightnessLv > 1.0:
currentBrightnessLv = 1.0
elif currentBrightnessLv < 0.0:
currentBrightnessLv = 0.0
sbcontrol.fade_brightness(int(100*currentBrightnessLv) , start = sbcontrol.get_brightness())
sbcontrol.fade_brightness(int(100*currentBrightnessLv) , start = sbcontrol.get_brightness(display=0))

def changesystemvolume():
"""sets system volume based on 'Controller.pinchlv'."""
Expand Down Expand Up @@ -597,4 +597,4 @@ def start(self):

# uncomment to run directly
# gc1 = GestureController()
# gc1.start()
# gc1.start()

0 comments on commit a275d9d

Please sign in to comment.