Merge pull request #557 from Sighthesia/MinimumBrightness

BrightnessService: add minimum brightness to prevent backlight from t…
This commit is contained in:
Lemmy
2025-10-26 19:16:07 -04:00
committed by GitHub
9 changed files with 49 additions and 9 deletions
+5 -1
View File
@@ -162,6 +162,10 @@
"brightness-step": {
"label": "Helligkeits-Schrittgröße",
"description": "Schrittgröße für Helligkeitsänderungen anpassen (Mausrad und Tastenkombinationen)."
},
"enforce-minimum": {
"label": "Mindesthelligkeit erzwingen (1%)",
"description": "Löst das Problem, dass die Hintergrundbeleuchtung auf einigen Displays bei 0% Helligkeit vollständig ausgeschaltet wird."
}
},
"night-light": {
@@ -1757,4 +1761,4 @@
"note": "Nur ein paar Grundeinstellungen alle Optionen befinden sich in den Einstellungen"
}
}
}
}
+5 -1
View File
@@ -162,6 +162,10 @@
"brightness-step": {
"label": "Brightness step size",
"description": "Adjust the step size for brightness changes (scroll wheel and keyboard shortcuts)."
},
"enforce-minimum": {
"label": "Enforce minimum brightness (1%)",
"description": "Solves the problem of backlight completely turning off on some displays at 0% brightness."
}
},
"night-light": {
@@ -1757,4 +1761,4 @@
"note": "Just a few basics to get you started - full options are in Settings"
}
}
}
}
+5 -1
View File
@@ -162,6 +162,10 @@
"brightness-step": {
"label": "Tamaño del paso de brillo",
"description": "Ajusta el tamaño del paso para los cambios de brillo (rueda de desplazamiento y atajos de teclado)."
},
"enforce-minimum": {
"label": "Forzar brillo mínimo (1%)",
"description": "Resuelve el problema de la retroiluminación que se apaga completamente en algunas pantallas al 0% de brillo."
}
},
"night-light": {
@@ -1757,4 +1761,4 @@
"note": "Solo algunos conceptos básicos para empezar: todas las opciones están en Configuración."
}
}
}
}
+5 -1
View File
@@ -162,6 +162,10 @@
"brightness-step": {
"label": "Incrément de luminosité",
"description": "Ajustez l'incrément pour les changements de luminosité (molette de la souris et raccourcis clavier)."
},
"enforce-minimum": {
"label": "Imposer une luminosité minimale (1%)",
"description": "Résout le problème de l'extinction complète du rétroéclairage sur certains écrans à 0% de luminosité."
}
},
"night-light": {
@@ -1757,4 +1761,4 @@
"note": "Quelques réglages de base pour démarrer — toutes les options sont dans Paramètres"
}
}
}
}
+5 -1
View File
@@ -162,6 +162,10 @@
"brightness-step": {
"label": "Tamanho do passo do brilho",
"description": "Ajuste o tamanho do passo para alterações de brilho (roda do mouse e atalhos de teclado)."
},
"enforce-minimum": {
"label": "Forçar brilho mínimo (1%)",
"description": "Resolve o problema da retroiluminação apagar completamente em alguns monitores com brilho em 0%."
}
},
"night-light": {
@@ -1757,4 +1761,4 @@
"note": "Apenas alguns ajustes básicos para começar - o restante está em Configurações"
}
}
}
}
+5 -1
View File
@@ -162,6 +162,10 @@
"brightness-step": {
"label": "亮度步长",
"description": "调整亮度变化的步长(滚轮和键盘快捷键)。"
},
"enforce-minimum": {
"label": "限制最小亮度为 1%",
"description": "解决亮度为 0% 时部分显示器背光完全关闭的问题。"
}
},
"night-light": {
@@ -1757,4 +1761,4 @@
"note": "先进行一些基础设置——更多选项可在“设置”中找到"
}
}
}
}
+1
View File
@@ -355,6 +355,7 @@ Singleton {
// brightness
property JsonObject brightness: JsonObject {
property int brightnessStep: 5
property bool enforceMinimum: true
}
property JsonObject colorSchemes: JsonObject {
+8
View File
@@ -155,6 +155,14 @@ ColumnLayout {
suffix: "%"
onValueChanged: Settings.data.brightness.brightnessStep = value
}
NToggle {
Layout.fillWidth: true
label: I18n.tr("settings.display.monitors.enforce-minimum.label")
description: I18n.tr("settings.display.monitors.enforce-minimum.description")
checked: Settings.data.brightness.enforceMinimum
onToggled: checked => Settings.data.brightness.enforceMinimum = checked
}
}
NDivider {
+10 -3
View File
@@ -233,7 +233,8 @@ Singleton {
}
}
readonly property real stepSize: Settings.data.brightness.brightnessStep / 100.0
readonly property real stepSize: Settings.data.brightness.brightnessStep / 100.0
readonly property real minBrightnessValue: (Settings.data.brightness.enforceMinimum ? 0.01 : 0.0)
// Timer for debouncing rapid changes
readonly property Timer timer: Timer {
@@ -253,7 +254,13 @@ Singleton {
function increaseBrightness(): void {
const value = !isNaN(monitor.queuedBrightness) ? monitor.queuedBrightness : monitor.brightness
setBrightnessDebounced(value + stepSize)
// Enforce minimum brightness if enabled
if (Settings.data.brightness.enforceMinimum && value <= minBrightnessValue) {
setBrightnessDebounced(Math.max(stepSize, minBrightnessValue))
} else {
// Normal brightness increase
setBrightnessDebounced(value + stepSize)
}
}
function decreaseBrightness(): void {
@@ -262,7 +269,7 @@ Singleton {
}
function setBrightness(value: real): void {
value = Math.max(0, Math.min(1, value))
value = Math.max(minBrightnessValue, Math.min(1, value))
var rounded = Math.round(value * 100)
if (timer.running) {