In awesome window manager, my screen brightness gets reset to 100% each time I'm away from my computer for a few minutes. How can I get it to sustain the brightness I set prior to these screen-saver/power-management timeouts?
Background:
Using autokey, I've created 3 scripts that enable me to adjust my screen's brightness with hotkeys. These scripts use the debian package brightnessctl to accomplish this:
sudo apt install brightnessctl For the sake of being helpful to others, I will include these scripts below.
Increase Brightness:
import os currentBrightness = system.exec_command("brightnessctl g") brightnessLevel = str(int(currentBrightness) + 1) if int(brightnessLevel) > 100: brightnessLevel = '100' if brightnessLevel: cmd = "brightnessctl s " + brightnessLevel os.system(cmd) store.set_global_value("lastBrightness",brightnessLevel) Decrease Brightness:
import os currentBrightness = system.exec_command("brightnessctl g") brightnessLevel = str(int(currentBrightness) - 1) if int(brightnessLevel) < 1: brightnessLevel = '1' if brightnessLevel: cmd = "brightnessctl s " + brightnessLevel os.system(cmd) store.set_global_value("lastBrightness",brightnessLevel) Set Brightness via Dialog:
import os currentBrightness = system.exec_command("brightnessctl g") lastBrightness = store.get_global_value("lastBrightness") if not lastBrightness: lastBrightness = '10' msg = None if (currentBrightness == lastBrightness): msg = 'Current Brightness = ' + currentBrightness + '\n\nSpecifiy your desired brightness (max is 100)?' else: msg = 'Current Brightness = ' + currentBrightness + '\n\nYou recently changed brightness to ' + lastBrightness + ', but something else changed it since then.\n\nSpecifiy your desired brightness (max is 100)?' os.system("numlockx on") # Turn Numlock On #ary = dialog.input_dialog(title="Brightness", message='Specifiy desired brightness (max is 100):', default='5') ary = dialog.input_dialog(title="Brightness", message=msg, default="10") brightnessLevel = ary[1] if brightnessLevel and int(brightnessLevel) > 0: store.set_global_value("lastBrightness",brightnessLevel) cmd = "brightnessctl s " + brightnessLevel os.system(cmd) While these scripts are working perfectly, I do have an issue:
When I'm away from my computer for a few minutes, and then come back, my monitor will be in some type of power saving state, where the monitor has been either turned off or displays a black screen. When I wake up the monitor (by hitting a key or moving my mouse) the brightness that I previously set (using brightnessctl), has been changed back to 100% brightness.
How can I sustain my brightness settings thorough these screen-saver/power-saving timeouts?