Skip to content

Instantly share code, notes, and snippets.

@mistivia
Created December 2, 2023 13:31
Show Gist options
  • Select an option

  • Save mistivia/b41a0c3e23b19c04dc9eb3ffa4fad94b to your computer and use it in GitHub Desktop.

Select an option

Save mistivia/b41a0c3e23b19c04dc9eb3ffa4fad94b to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import os
import sys
dir = "/sys/class/backlight/amdgpu_bl0"
maxb = 1000
with open(dir + '/max_brightness') as fp:
maxb = int(fp.read())
i = int(sys.argv[1])
if i < 10: i = 10
if i > 100: i = 100
value = maxb * i / 100
cmd = 'echo ' + str(int(value)) + ' | sudo tee /sys/class/backlight/amdgpu_bl0/brightness > /dev/null'
os.system(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment