mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-05 13:57:36 +00:00
BrightnessService: add switch to toggle minimum brightness limit
This commit is contained in:
@@ -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": {
|
||||
@@ -1731,4 +1735,4 @@
|
||||
"note": "Nur ein paar Grundeinstellungen – alle Optionen befinden sich in den Einstellungen"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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": {
|
||||
@@ -1731,4 +1735,4 @@
|
||||
"note": "Just a few basics to get you started - full options are in Settings"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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": {
|
||||
@@ -1731,4 +1735,4 @@
|
||||
"note": "Solo algunos conceptos básicos para empezar: todas las opciones están en Configuración."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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": {
|
||||
@@ -1731,4 +1735,4 @@
|
||||
"note": "Quelques réglages de base pour démarrer — toutes les options sont dans Paramètres"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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": {
|
||||
@@ -1731,4 +1735,4 @@
|
||||
"note": "Apenas alguns ajustes básicos para começar - o restante está em Configurações"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,6 +162,10 @@
|
||||
"brightness-step": {
|
||||
"label": "亮度步长",
|
||||
"description": "调整亮度变化的步长(滚轮和键盘快捷键)。"
|
||||
},
|
||||
"enforce-minimum": {
|
||||
"label": "限制最小亮度为 1%",
|
||||
"description": "解决亮度为 0% 时部分显示器背光完全关闭的问题。"
|
||||
}
|
||||
},
|
||||
"night-light": {
|
||||
@@ -1731,4 +1735,4 @@
|
||||
"note": "先进行一些基础设置——更多选项可在“设置”中找到"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,6 +352,7 @@ Singleton {
|
||||
// brightness
|
||||
property JsonObject brightness: JsonObject {
|
||||
property int brightnessStep: 5
|
||||
property bool enforceMinimum: true
|
||||
}
|
||||
|
||||
property JsonObject colorSchemes: JsonObject {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,9 +254,9 @@ Singleton {
|
||||
|
||||
function increaseBrightness(): void {
|
||||
const value = !isNaN(monitor.queuedBrightness) ? monitor.queuedBrightness : monitor.brightness
|
||||
// Set to step size if currently at minimum brightness
|
||||
if (value <= 0.01) {
|
||||
setBrightnessDebounced(Math.max(stepSize, 0.01))
|
||||
// Enforce minimum brightness if enabled
|
||||
if (Settings.data.brightness.enforceMinimum && value <= minBrightnessValue) {
|
||||
setBrightnessDebounced(Math.max(stepSize, minBrightnessValue))
|
||||
} else {
|
||||
// Normal brightness increase
|
||||
setBrightnessDebounced(value + stepSize)
|
||||
@@ -268,8 +269,7 @@ Singleton {
|
||||
}
|
||||
|
||||
function setBrightness(value: real): void {
|
||||
// Enforce a minimum brightness of 1% (0.01) to avoid completely turning off the backlight
|
||||
value = Math.max(0.01, Math.min(1, value))
|
||||
value = Math.max(minBrightnessValue, Math.min(1, value))
|
||||
var rounded = Math.round(value * 100)
|
||||
|
||||
if (timer.running) {
|
||||
|
||||
Reference in New Issue
Block a user