From 62d613a2bca9797ecb280d7382884600698c5acc Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 6 Jan 2019 20:53:00 +0000 Subject: [PATCH] removed debug code --- brightness.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/brightness.py b/brightness.py index 91ca96a..34e6c7b 100755 --- a/brightness.py +++ b/brightness.py @@ -3,29 +3,20 @@ import os, sys, string, subprocess def main(): - cmd = "xrandr --verbose | grep {} -A 5 | grep Brightness | cut -f 2 -d ' '".format(test()) + cmd = "xrandr --verbose | grep {} -A 5 | grep Brightness | cut -f 2 -d ' '".format(display()) brightness = float(subprocess.getoutput(cmd)) if sys.argv[1] == "+" and brightness < 1: brightness += .25 elif sys.argv[1] == "-" and brightness > 0: brightness -= .25 - os.system("xrandr --output {} --brightness {}".format(test(), brightness)) - -def test(): - cmd = "xdotool getmouselocation --shell | head -n -3 | sed 's/[^0-9]*//g'" - cmd = subprocess.getoutput(cmd) - mouse = cmd.split() - - if int(mouse[0]) < 2560: - return "DP-1" - return "DP-2" + os.system("xrandr --output {} --brightness {}".format(display(), brightness)) def display(): - cmd = "i3-msg -t get_workspaces | jq '.[] | select(.focused==true).name'" - cmd = subprocess.getoutput(cmd).replace("\"", "") + cmd = "xdotool getmouselocation --shell | head -n -3 | sed 's/[^0-9]*//g'" + cmd = subprocess.getoutput(cmd) - if cmd == "8: ": + if int(cmd) < 2560: return "DP-1" return "DP-2"