Decrease gamma when brightness is requested to go lower beyond 0

This commit is contained in:
altrup
2026-03-22 16:36:17 -04:00
parent 8aa9041106
commit 4caa59dd9e
9 changed files with 72 additions and 30 deletions
@@ -28,6 +28,12 @@ Singleton {
}
function increaseBrightness(): void {
// if gamma is not yet 100, first increase gamma
if (Hyprsunset.gamma !== 100) {
Hyprsunset.setGamma(Hyprsunset.gamma + 5);
return;
}
const focusedName = Hyprland.focusedMonitor.name;
const monitor = monitors.find(m => focusedName === m.screen.name);
if (monitor)
@@ -37,8 +43,12 @@ Singleton {
function decreaseBrightness(): void {
const focusedName = Hyprland.focusedMonitor.name;
const monitor = monitors.find(m => focusedName === m.screen.name);
if (monitor)
if (monitor && monitor.brightness > 0)
monitor.setBrightness(monitor.brightness - 0.05);
// if brightness is 0, then decrease gamma
else {
Hyprsunset.setGamma(Hyprsunset.gamma - 5);
}
}
reloadableId: "brightness"