From fe2654268dd27c59b6124bd5e02c004ba4e9e81c Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Sat, 27 Sep 2025 15:14:44 +0200 Subject: [PATCH] NightLight: check if wlsunset exists, else dont enable NightLight SystemMonitorSettings: If RAM usage is not toggled, don't show % option Settings: remove NightLight from default bar widgets --- Assets/settings-default.json | 5 +---- Commons/Settings.qml | 6 ++---- Modules/Bar/Widgets/NightLight.qml | 6 ++++++ .../Settings/Bar/WidgetSettings/SystemMonitorSettings.qml | 1 + Services/ProgramCheckerService.qml | 4 +++- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Assets/settings-default.json b/Assets/settings-default.json index 55a851c8..7ea8b3f7 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -1,5 +1,5 @@ { - "settingsVersion": 8, + "settingsVersion": 9, "bar": { "position": "top", "backgroundOpacity": 1, @@ -51,9 +51,6 @@ { "id": "Brightness" }, - { - "id": "NightLight" - }, { "id": "Clock" }, diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 819f11be..77623d7b 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -114,7 +114,7 @@ Singleton { JsonAdapter { id: adapter - property int settingsVersion: 8 + property int settingsVersion: 9 // bar property JsonObject bar: JsonObject { @@ -156,10 +156,8 @@ Singleton { "id": "Battery" }, { "id": "Volume" - }, { + }, { "id": "Brightness" - }, { - "id": "NightLight" }, { "id": "Clock" }, { diff --git a/Modules/Bar/Widgets/NightLight.qml b/Modules/Bar/Widgets/NightLight.qml index 3be8cf53..605f572a 100644 --- a/Modules/Bar/Widgets/NightLight.qml +++ b/Modules/Bar/Widgets/NightLight.qml @@ -24,6 +24,12 @@ NIconButton { 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") onClicked: { + // Check if wlsunset is available before enabling night light + if (!ProgramCheckerService.wlsunsetAvailable) { + ToastService.showWarning(I18n.tr("settings.display.night-light.section.label"), I18n.tr("toast.night-light.not-installed")) + return + } + if (!Settings.data.nightLight.enabled) { Settings.data.nightLight.enabled = true Settings.data.nightLight.forced = false diff --git a/Modules/Settings/Bar/WidgetSettings/SystemMonitorSettings.qml b/Modules/Settings/Bar/WidgetSettings/SystemMonitorSettings.qml index b7524c86..06ba806d 100644 --- a/Modules/Settings/Bar/WidgetSettings/SystemMonitorSettings.qml +++ b/Modules/Settings/Bar/WidgetSettings/SystemMonitorSettings.qml @@ -62,6 +62,7 @@ ColumnLayout { label: I18n.tr("bar.widget-settings.system-monitor.memory-percentage") checked: valueShowMemoryAsPercent onToggled: checked => valueShowMemoryAsPercent = checked + visible: valueShowMemoryUsage } NToggle { diff --git a/Services/ProgramCheckerService.qml b/Services/ProgramCheckerService.qml index f8e4fa98..a7d5f436 100644 --- a/Services/ProgramCheckerService.qml +++ b/Services/ProgramCheckerService.qml @@ -18,6 +18,7 @@ Singleton { property bool fuzzelAvailable: false property bool vesktopAvailable: false property bool gpuScreenRecorderAvailable: false + property bool wlsunsetAvailable: false // Signal emitted when all checks are complete signal checksCompleted @@ -31,7 +32,8 @@ Singleton { "footAvailable": ["which", "foot"], "fuzzelAvailable": ["which", "fuzzel"], "vesktopAvailable": ["which", "vesktop"], - "gpuScreenRecorderAvailable": ["sh", "-c", "command -v gpu-screen-recorder >/dev/null 2>&1 || (command -v flatpak >/dev/null 2>&1 && flatpak list --app | grep -q 'com.dec05eba.gpu_screen_recorder')"] + "gpuScreenRecorderAvailable": ["sh", "-c", "command -v gpu-screen-recorder >/dev/null 2>&1 || (command -v flatpak >/dev/null 2>&1 && flatpak list --app | grep -q 'com.dec05eba.gpu_screen_recorder')"], + "wlsunsetAvailable": ["which", "wlsunset"] }) // Internal tracking