From 8a0c0b4aec240347574148cceb8400c881242db7 Mon Sep 17 00:00:00 2001 From: lysec Date: Tue, 7 Oct 2025 13:26:39 +0200 Subject: [PATCH] TopCard: check if wlsunset/gpu-screen-recorder is installed, else disable buttons i18n: add tooltips --- Assets/Translations/de.json | 1 + Assets/Translations/en.json | 1 + Assets/Translations/es.json | 1 + Assets/Translations/fr.json | 1 + Assets/Translations/pt.json | 1 + Assets/Translations/zh-CN.json | 1 + Modules/ControlCenter/Cards/TopCard.qml | 11 +++++++---- 7 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index c39eda4e..021a823f 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -1177,6 +1177,7 @@ "night-light-disabled": "Nachtlicht ist deaktiviert.\\nLinksklick zum Wechseln des Modus.\\nRechtsklick für Einstellungen.", "night-light-enabled": "Nachtlicht ist aktiviert.\\nLinksklick zum Wechseln des Modus.\\nRechtsklick für Einstellungen.", "night-light-forced": "Nachtlicht ist erzwungen.\\nLinksklick zum Wechseln des Modus.\\nRechtsklick für Einstellungen.", + "night-light-not-installed": "Nachtlicht ist nicht verfügbar.\\nwlsunset ist nicht installiert.", "click-to-start-recording": "Klicken zum Starten der Aufnahme", "click-to-stop-recording": "Klicken zum Stoppen der Aufnahme", "open-control-center": "Kontrollzentrum öffnen", diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 4749c20a..ff91166a 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -1158,6 +1158,7 @@ "night-light-disabled": "Night light is disabled.\nLeft click to cycle mode.\nRight click to access settings.", "night-light-enabled": "Night light is enabled.\nLeft click to cycle mode.\nRight click to access settings.", "night-light-forced": "Night light is forced.\nLeft click to cycle mode.\nRight click to access settings.", + "night-light-not-installed": "Night light is not available.\nwlsunset is not installed.", "click-to-start-recording": "Click to start recording", "click-to-stop-recording": "Click to stop recording", "open-control-center": "Open control center", diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index b2de0545..f33d2e0c 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -1156,6 +1156,7 @@ "night-light-disabled": "Luz nocturna desactivada.\nClic izquierdo para cambiar de modo.\nClic derecho para acceder a la configuración.", "night-light-enabled": "Luz nocturna activada.\nClic izquierdo para cambiar de modo.\nClic derecho para acceder a la configuración.", "night-light-forced": "Luz nocturna forzada.\nClic izquierdo para cambiar de modo.\nClic derecho para acceder a la configuración.", + "night-light-not-installed": "Luz nocturna no disponible.\nwlsunset no está instalado.", "click-to-start-recording": "Haz clic para iniciar la grabación", "click-to-stop-recording": "Haz clic para detener la grabación", "open-control-center": "Abrir el centro de control", diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index 5a2070c8..a087896a 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -1156,6 +1156,7 @@ "night-light-disabled": "L'éclairage nocturne est désactivé.\nClic gauche pour changer de mode.\nClic droit pour accéder aux paramètres.", "night-light-enabled": "L'éclairage nocturne est activé.\nClic gauche pour changer de mode.\nClic droit pour accéder aux paramètres.", "night-light-forced": "L'éclairage nocturne est forcé.\nClic gauche pour changer de mode.\nClic droit pour accéder aux paramètres.", + "night-light-not-installed": "L'éclairage nocturne n'est pas disponible.\nwlsunset n'est pas installé.", "click-to-start-recording": "Cliquez pour démarrer l'enregistrement", "click-to-stop-recording": "Cliquez pour arrêter l'enregistrement", "open-control-center": "Ouvrir le centre de contrôle", diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index 7790f6aa..d9b1d538 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -1156,6 +1156,7 @@ "night-light-disabled": "Luz noturna desativada.\nClique esquerdo para alternar o modo.\nClique direito para acessar as configurações.", "night-light-enabled": "Luz noturna ativada.\nClique esquerdo para alternar o modo.\nClique direito para acessar as configurações.", "night-light-forced": "Luz noturna forçada.\nClique esquerdo para alternar o modo.\nClique direito para acessar as configurações.", + "night-light-not-installed": "Luz noturna não disponível.\nwlsunset não está instalado.", "click-to-start-recording": "Clique para iniciar a gravação", "click-to-stop-recording": "Clique para parar a gravação", "open-control-center": "Abrir central de controle", diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index e36793be..8bdfbce4 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -1156,6 +1156,7 @@ "night-light-disabled": "夜间模式已禁用。\n左键点击循环模式。\n右键点击访问设置。", "night-light-enabled": "夜间模式已启用。\n左键点击循环模式。\n右键点击访问设置。", "night-light-forced": "夜间模式已强制启用。\n左键点击循环模式。\n右键点击访问设置。", + "night-light-not-installed": "夜间模式不可用。\nwlsunset 未安装。", "click-to-start-recording": "点击开始录制", "click-to-stop-recording": "点击停止录制", "open-control-center": "打开控制中心", diff --git a/Modules/ControlCenter/Cards/TopCard.qml b/Modules/ControlCenter/Cards/TopCard.qml index b2b9a1e1..5bfd69a0 100644 --- a/Modules/ControlCenter/Cards/TopCard.qml +++ b/Modules/ControlCenter/Cards/TopCard.qml @@ -114,12 +114,13 @@ NBox { NIconButton { baseSize: Style.baseWidgetSize * 0.8 icon: "camera-video" - enabled: ScreenRecorderService.isAvailable - tooltipText: ScreenRecorderService.isAvailable ? (ScreenRecorderService.isRecording ? I18n.tr("tooltips.stop-screen-recording") : I18n.tr("tooltips.start-screen-recording")) : I18n.tr("tooltips.screen-recorder-not-installed") + enabled: ProgramCheckerService.gpuScreenRecorderAvailable + opacity: ProgramCheckerService.gpuScreenRecorderAvailable ? Style.opacityFull : Style.opacityMedium + tooltipText: ProgramCheckerService.gpuScreenRecorderAvailable ? (ScreenRecorderService.isRecording ? I18n.tr("tooltips.stop-screen-recording") : I18n.tr("tooltips.start-screen-recording")) : I18n.tr("tooltips.screen-recorder-not-installed") colorBg: ScreenRecorderService.isRecording ? Color.mPrimary : Color.mSurfaceVariant colorFg: ScreenRecorderService.isRecording ? Color.mOnPrimary : Color.mPrimary onClicked: { - if (!ScreenRecorderService.isAvailable) + if (!ProgramCheckerService.gpuScreenRecorderAvailable) return ScreenRecorderService.toggleRecording() // If we were not recording and we just initiated a start, close the panel @@ -199,10 +200,12 @@ NBox { // Night Light NIconButton { baseSize: Style.baseWidgetSize * 0.8 + enabled: ProgramCheckerService.wlsunsetAvailable + opacity: ProgramCheckerService.wlsunsetAvailable ? Style.opacityFull : Style.opacityMedium colorBg: Settings.data.nightLight.forced ? Color.mPrimary : Color.transparent colorFg: Settings.data.nightLight.forced ? Color.mOnPrimary : Color.mPrimary icon: Settings.data.nightLight.enabled ? (Settings.data.nightLight.forced ? "nightlight-forced" : "nightlight-on") : "nightlight-off" - tooltipText: Settings.data.nightLight.enabled ? (Settings.data.nightLight.forced ? I18n.tr("tooltips.night-light-forced") : I18n.tr("tooltips.night-light-enabled")) : I18n.tr("tooltips.night-light-disabled") + tooltipText: ProgramCheckerService.wlsunsetAvailable ? (Settings.data.nightLight.enabled ? (Settings.data.nightLight.forced ? I18n.tr("tooltips.night-light-forced") : I18n.tr("tooltips.night-light-enabled")) : I18n.tr("tooltips.night-light-disabled")) : I18n.tr("tooltips.night-light-not-installed") onClicked: { // Check if wlsunset is available before enabling night light if (!ProgramCheckerService.wlsunsetAvailable) {