48 lines
907 B
Python
Executable File
48 lines
907 B
Python
Executable File
#!/usr/bin/env python
|
|
import subprocess
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("brightnesschange")
|
|
args = parser.parse_args()
|
|
|
|
|
|
def get_brightness() -> str:
|
|
return str(
|
|
(
|
|
int(
|
|
subprocess.check_output(
|
|
["cat", "/sys/class/backlight/intel_backlight/brightness"]
|
|
)
|
|
)
|
|
/ int(
|
|
subprocess.check_output(
|
|
["cat", "/sys/class/backlight/intel_backlight/max_brightness"]
|
|
)
|
|
)
|
|
* 100
|
|
).__round__()
|
|
)
|
|
|
|
|
|
subprocess.check_output(
|
|
[
|
|
"brightnessctl",
|
|
"set",
|
|
args.brightnesschange,
|
|
]
|
|
)
|
|
|
|
print(get_brightness())
|
|
|
|
subprocess.call(
|
|
[
|
|
"dunstify",
|
|
"brightness",
|
|
"-h",
|
|
"int:value:" + get_brightness(),
|
|
"-r",
|
|
"294893284",
|
|
]
|
|
)
|