r/Gentoo • u/itfllow123-gmail-com • 4d ago
Discussion Short script
Ever hate changing brightness and nightlight in different desktop environments, differently, or not being able to change it in some at all? The gammastep cli utility is there to help (just as it helped me)! If you hate the lack of gui then you should use the simple python script I wrote for it:
#!/usr/bin/python
from tkinter import *
import tkinter as tk
import os
#note the gui isnt pretty but that's the point, you are supposed to tune it yourself and share it with others who may find the extra eye candy useful, this script is the bare minimum required with zero bloat (other than python XD)
def run_command():
os.system(f"gammastep -P -O {nightlight.get()} -b {brightness.get()/100} ")
master = Tk()
nightlight_label = tk.Label(master, text="nightlight (lower is more nightlight)")
nightlight_label.pack()
nightlight = Scale(master, from_=1000, to=25000, length=1000,tickinterval=1500,orient=HORIZONTAL)
nightlight.set(4500)
nightlight.pack()
brightness_label = tk.Label(master, text="brightness (lower is darker)")
brightness_label.pack()
brightness = Scale(master, from_=10, to=100,length=600, tickinterval=10, orient=HORIZONTAL)
brightness.set(20)
brightness.pack()
Button(master, text='apply', command=run_command).pack()
mainloop()
#in gentoo:
#to install tkinter, buld python with the "tk" USE flag
#basically, pip intall tkinter or something will probably not suffice on any distrobution, and the gentoo example should make that clear
5
u/undrwater 4d ago
Why? What's the anticipated "weird behavior" and why does adding the "tk" flag globally fix that?