51 lines
721 B
Python
Executable File
51 lines
721 B
Python
Executable File
#!/usr/bin/env python3
|
||
|
||
"""
|
||
Tkinter GUI to adjust xrandr brightness setting on the fly
|
||
"""
|
||
|
||
from tkinter import *
|
||
import os
|
||
|
||
c = 70
|
||
d = 5
|
||
|
||
def setb():
|
||
lab.config(text = "%u%%" % c)
|
||
os.system("xrandr --output DFP2 --brightness %f" % (c / 100))
|
||
|
||
def m():
|
||
global c
|
||
|
||
if c > 0:
|
||
c -= d
|
||
setb()
|
||
|
||
def p():
|
||
global c
|
||
|
||
if c < 100:
|
||
c += d
|
||
setb()
|
||
|
||
master = Tk()
|
||
|
||
f1 = Frame(master)
|
||
f1.pack(side = TOP, fill = Y)
|
||
f2 = Frame(master)
|
||
f2.pack(side = BOTTOM, fill = Y)
|
||
|
||
minus_but = Button(f1, text = " − ", command = m)
|
||
minus_but.pack(side = LEFT)
|
||
plus_but = Button(f1, text = " + ", command = p)
|
||
plus_but.pack(side = RIGHT)
|
||
lab = Label(f2, text = '')
|
||
lab.pack(side = TOP)
|
||
|
||
setb()
|
||
|
||
master.title("PyBright")
|
||
|
||
mainloop()
|
||
|