Added a check to see if wlsunset is enabled, if it isn't you can change

the NightLight settings.
DisplayTab: add wlsunsetCheck process
This commit is contained in:
Ly-sec 2025-08-28 17:06:53 +02:00
parent a845067cf0
commit 39d8d8bcfa
3 changed files with 31 additions and 5 deletions

View file

@ -111,7 +111,7 @@ NPanel {
id: checkbox id: checkbox
label: "" label: ""
description: "" description: ""
checked: (ArchUpdaterService.selectedPackagesCount, ArchUpdaterService.isPackageSelected(modelData.name)) checked: (ArchUpdaterService.selectedPackagesCountArchUpdaterService.isPackageSelected(modelData.name))
onToggled: ArchUpdaterService.togglePackageSelection(modelData.name) onToggled: ArchUpdaterService.togglePackageSelection(modelData.name)
activeColor: (modelData.source === "aur") ? Color.mSecondary : Color.mPrimary activeColor: (modelData.source === "aur") ? Color.mSecondary : Color.mPrimary
activeOnColor: (modelData.source === "aur") ? Color.mOnSecondary : Color.mOnPrimary activeOnColor: (modelData.source === "aur") ? Color.mOnSecondary : Color.mOnPrimary

View file

@ -2,6 +2,7 @@ import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls import QtQuick.Controls
import Quickshell import Quickshell
import Quickshell.Io
import qs.Commons import qs.Commons
import qs.Services import qs.Services
import qs.Widgets import qs.Widgets
@ -27,6 +28,27 @@ ColumnLayout {
} }
} }
// Check for wlsunset availability when enabling Night Light
Process {
id: wlsunsetCheck
command: ["which", "wlsunset"]
running: false
onExited: function (exitCode) {
if (exitCode === 0) {
Settings.data.nightLight.enabled = true
NightLightService.apply()
ToastService.showNotice("Night Light", "Enabled")
} else {
Settings.data.nightLight.enabled = false
ToastService.showWarning("Night Light", "wlsunset not installed")
}
}
stdout: StdioCollector {}
stderr: StdioCollector {}
}
// Helper functions to update arrays immutably // Helper functions to update arrays immutably
function addMonitor(list, name) { function addMonitor(list, name) {
const arr = (list || []).slice() const arr = (list || []).slice()
@ -240,8 +262,14 @@ ColumnLayout {
description: "Apply a warm color filter to reduce blue light emission." description: "Apply a warm color filter to reduce blue light emission."
checked: Settings.data.nightLight.enabled checked: Settings.data.nightLight.enabled
onToggled: checked => { onToggled: checked => {
Settings.data.nightLight.enabled = checked if (checked) {
// Verify wlsunset exists before enabling
wlsunsetCheck.running = true
} else {
Settings.data.nightLight.enabled = false
NightLightService.apply() NightLightService.apply()
ToastService.showNotice("Night Light", "Disabled")
}
} }
} }

View file

@ -11,10 +11,8 @@ RowLayout {
property string description: "" property string description: ""
property bool checked: false property bool checked: false
property bool hovering: false property bool hovering: false
// Active state colors (allow override per-usage)
property color activeColor: Color.mPrimary property color activeColor: Color.mPrimary
property color activeOnColor: Color.mOnPrimary property color activeOnColor: Color.mOnPrimary
// Smaller default footprint than NToggle
property int baseSize: Math.max(Style.baseWidgetSize * 0.8, 14) property int baseSize: Math.max(Style.baseWidgetSize * 0.8, 14)
signal toggled(bool checked) signal toggled(bool checked)