aboutsummaryrefslogtreecommitdiff
path: root/.config/i3blocks/scripts/brightness.py
diff options
context:
space:
mode:
Diffstat (limited to '.config/i3blocks/scripts/brightness.py')
-rwxr-xr-x.config/i3blocks/scripts/brightness.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/.config/i3blocks/scripts/brightness.py b/.config/i3blocks/scripts/brightness.py
deleted file mode 100755
index 983a54f..0000000
--- a/.config/i3blocks/scripts/brightness.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/python3
-# This script is for my i3blocks bar, its handles scrolling to change
-# brightness of monitor
-
-import subprocess
-import re
-import os
-
-display = "eDP-1"
-
-proc = subprocess.Popen("xrandr --verbose | grep Brightness", shell=True,
- stdout=subprocess.PIPE)
-
-
-res = proc.stdout.readline().strip()
-res = str(res)
-
-num = re.compile("\d\.\d+")
-bri = num.findall(res)[0]
-
-bri = round(float(bri)*100)
-
-env = os.environ
-if 'BLOCK_BUTTON' in env:
- button = env['BLOCK_BUTTON']
- if button is not '':
- button = int(button)
- if button is 4:
- new_bri = bri + 5
- elif button is 5:
- new_bri = bri - 5
- else:
- new_bri = bri
-
- if new_bri <= 100 and new_bri >= 10:
- bri = new_bri
- new_bri = new_bri/100
- subprocess.call(f"xrandr --output {display} --brightness {new_bri}",
- shell=True)
- subprocess.call(f"echo {new_bri} > ~/.last_brightness", shell=True)
-
-print(f"{bri}%")