Replace our NightLight solution with wlsunset.
NightLight: add temperature solution NTextInput: add input hint support
This commit is contained in:
parent
57a67bf4df
commit
2a686b55c4
9 changed files with 167 additions and 130 deletions
|
|
@ -17,21 +17,19 @@ Item {
|
|||
|
||||
NPill {
|
||||
id: pill
|
||||
icon: NightLightService.isActive ? "bedtime" : "bedtime_off"
|
||||
iconCircleColor: NightLightService.isActive ? Color.mSecondary : Color.mOnSurfaceVariant
|
||||
collapsedIconColor: NightLightService.isActive ? Color.mOnSecondary : Color.mOnSurface
|
||||
icon: Settings.data.nightLight.enabled ? "bedtime" : "bedtime_off"
|
||||
iconCircleColor: Settings.data.nightLight.enabled ? Color.mSecondary : Color.mOnSurfaceVariant
|
||||
collapsedIconColor: Settings.data.nightLight.enabled ? Color.mOnSecondary : Color.mOnSurface
|
||||
autoHide: false
|
||||
text: NightLightService.isActive ? "On" : "Off"
|
||||
text: Settings.data.nightLight.enabled ? "On" : "Off"
|
||||
tooltipText: {
|
||||
if (!Settings.isLoaded || !Settings.data.nightLight.enabled) {
|
||||
return "Night Light: Disabled\nLeft click to open settings.\nRight click to enable."
|
||||
}
|
||||
|
||||
var status = NightLightService.isActive ? "Active" : "Inactive (outside schedule)"
|
||||
var intensity = Math.round(Settings.data.nightLight.intensity * 100)
|
||||
var schedule = Settings.data.nightLight.autoSchedule ? `Schedule: ${Settings.data.nightLight.startTime} - ${Settings.data.nightLight.stopTime}` : "Manual mode"
|
||||
|
||||
return `Intensity: ${intensity}%\n${schedule}\nLeft click to open settings.\nRight click to toggle.`
|
||||
var schedule = Settings.data.nightLight.autoSchedule ? `Auto schedule` : `Manual: ${Settings.data.nightLight.startTime} - ${Settings.data.nightLight.stopTime}`
|
||||
return `Night Light: Enabled\nIntensity: ${intensity}%\n${schedule}\nLeft click to open settings.\nRight click to toggle.`
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
|
|
@ -42,14 +40,11 @@ Item {
|
|||
}
|
||||
|
||||
onRightClicked: {
|
||||
// Right click - toggle night light
|
||||
// Right click - toggle night light (debounced apply handled by service)
|
||||
Settings.data.nightLight.enabled = !Settings.data.nightLight.enabled
|
||||
NightLightService.apply()
|
||||
}
|
||||
|
||||
onWheel: delta => {
|
||||
var diff = delta > 0 ? 0.05 : -0.05
|
||||
Settings.data.nightLight.intensity = Math.max(0, Math.min(1.0,
|
||||
Settings.data.nightLight.intensity + diff))
|
||||
}
|
||||
// Wheel handler removed to avoid frequent rapid restarts/flicker
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
delegate: Loader {
|
||||
required property ShellScreen modelData
|
||||
readonly property real scaling: ScalingService.scale(modelData)
|
||||
|
||||
active: NightLightService.isActive
|
||||
|
||||
sourceComponent: PanelWindow {
|
||||
screen: modelData
|
||||
color: Color.transparent
|
||||
anchors {
|
||||
top: true
|
||||
bottom: true
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
|
||||
// Ensure a full click through
|
||||
mask: Region {}
|
||||
|
||||
WlrLayershell.layer: WlrLayershell.Overlay
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
WlrLayershell.namespace: "noctalia-nightlight"
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: NightLightService.overlayColor
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationSlow
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -239,7 +239,10 @@ ColumnLayout {
|
|||
label: "Enable Night Light"
|
||||
description: "Apply a warm color filter to reduce blue light emission."
|
||||
checked: Settings.data.nightLight.enabled
|
||||
onToggled: checked => Settings.data.nightLight.enabled = checked
|
||||
onToggled: checked => {
|
||||
Settings.data.nightLight.enabled = checked
|
||||
NightLightService.apply()
|
||||
}
|
||||
}
|
||||
|
||||
// Intensity settings
|
||||
|
|
@ -257,7 +260,10 @@ ColumnLayout {
|
|||
to: 1
|
||||
stepSize: 0.01
|
||||
value: Settings.data.nightLight.intensity
|
||||
onMoved: Settings.data.nightLight.intensity = value
|
||||
onMoved: {
|
||||
Settings.data.nightLight.intensity = value
|
||||
NightLightService.apply()
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 150 * scaling
|
||||
}
|
||||
|
|
@ -271,11 +277,59 @@ ColumnLayout {
|
|||
}
|
||||
}
|
||||
|
||||
// Temperature settings (inline like schedule)
|
||||
RowLayout {
|
||||
visible: Settings.data.nightLight.enabled
|
||||
Layout.fillWidth: false
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
NText {
|
||||
text: "Low"
|
||||
font.pointSize: Style.fontSizeM * scaling
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
NTextInput {
|
||||
text: Settings.data.nightLight.lowTemp.toString()
|
||||
inputMethodHints: Qt.ImhDigitsOnly
|
||||
Layout.preferredWidth: 100 * scaling
|
||||
onEditingFinished: {
|
||||
var v = parseInt(text)
|
||||
if (!isNaN(v)) {
|
||||
Settings.data.nightLight.lowTemp = Math.max(1000, Math.min(6500, v))
|
||||
NightLightService.apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {}
|
||||
|
||||
NText {
|
||||
text: "High"
|
||||
font.pointSize: Style.fontSizeM * scaling
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
NTextInput {
|
||||
text: Settings.data.nightLight.highTemp.toString()
|
||||
inputMethodHints: Qt.ImhDigitsOnly
|
||||
Layout.preferredWidth: 100 * scaling
|
||||
onEditingFinished: {
|
||||
var v = parseInt(text)
|
||||
if (!isNaN(v)) {
|
||||
Settings.data.nightLight.highTemp = Math.max(1000, Math.min(10000, v))
|
||||
NightLightService.apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: "Auto Schedule"
|
||||
description: "Automatically enable night light based on time schedule."
|
||||
checked: Settings.data.nightLight.autoSchedule
|
||||
onToggled: checked => Settings.data.nightLight.autoSchedule = checked
|
||||
onToggled: checked => {
|
||||
Settings.data.nightLight.autoSchedule = checked
|
||||
NightLightService.apply()
|
||||
}
|
||||
visible: Settings.data.nightLight.enabled
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +357,7 @@ ColumnLayout {
|
|||
model: timeOptions
|
||||
currentKey: Settings.data.nightLight.startTime
|
||||
placeholder: "Select start time"
|
||||
onSelected: key => Settings.data.nightLight.startTime = key
|
||||
onSelected: key => { Settings.data.nightLight.startTime = key; NightLightService.apply() }
|
||||
preferredWidth: 120 * scaling
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +373,7 @@ ColumnLayout {
|
|||
model: timeOptions
|
||||
currentKey: Settings.data.nightLight.stopTime
|
||||
placeholder: "Select stop time"
|
||||
onSelected: key => Settings.data.nightLight.stopTime = key
|
||||
onSelected: key => { Settings.data.nightLight.stopTime = key; NightLightService.apply() }
|
||||
preferredWidth: 120 * scaling
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue