diff options
| author | Alec Goncharow <Alec.Goncharow@gmail.com> | 2018-08-06 23:17:05 -0400 |
|---|---|---|
| committer | Alec Goncharow <Alec.Goncharow@gmail.com> | 2018-08-06 23:17:05 -0400 |
| commit | 1f03f2b3ed8e9151a06bcb5635a061fb6098ea50 (patch) | |
| tree | 950931c33352c55a41b49e8a80c4f76184efa56c /.config/i3blocks/scripts/old_brightness.py | |
| parent | cdbc5a4a00526b9963b82efb0651f8a5c5515bb9 (diff) | |
Added some scripts I imported/wrote for my i3blocks
Diffstat (limited to '.config/i3blocks/scripts/old_brightness.py')
| -rwxr-xr-x | .config/i3blocks/scripts/old_brightness.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/.config/i3blocks/scripts/old_brightness.py b/.config/i3blocks/scripts/old_brightness.py new file mode 100755 index 0000000..993856e --- /dev/null +++ b/.config/i3blocks/scripts/old_brightness.py @@ -0,0 +1,17 @@ +#!/usr/bin/python3 + +backlight_dir = '/sys/class/backlight/intel_backlight/' + +brightness_file = 'brightness' +max_brightness_file = 'max_brightness' + +brightness = int(open(backlight_dir + brightness_file).read()) +max_brightness = int(open(backlight_dir + max_brightness_file).read()) + +ratio = (brightness / max_brightness) +percent = ratio * 100 + +round_percent = percent + 2.5 +round_percent = round_percent - round_percent%5 + +print("{}%".format(round(round_percent))) |
