mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
NightLight: refactored the code to make simpler
- using intensity instead of warmth - animated color transition - removed unecessary bindings and double properties - using better icons to avoid confusion with brightness - polished settings UI
This commit is contained in:
@@ -11,17 +11,11 @@ Variants {
|
||||
required property ShellScreen modelData
|
||||
readonly property real scaling: ScalingService.scale(modelData)
|
||||
|
||||
active: NightLightService.enabled
|
||||
active: NightLightService.isActive
|
||||
|
||||
sourceComponent: PanelWindow {
|
||||
id: nightlightWindow
|
||||
|
||||
screen: modelData
|
||||
visible: NightLightService.isActive
|
||||
color: Color.transparent
|
||||
|
||||
mask: Region {}
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
bottom: true
|
||||
@@ -29,6 +23,9 @@ Variants {
|
||||
right: true
|
||||
}
|
||||
|
||||
// Ensure a full click through
|
||||
mask: Region {}
|
||||
|
||||
WlrLayershell.layer: WlrLayershell.Overlay
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
@@ -37,29 +34,13 @@ Variants {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: NightLightService.overlayColor
|
||||
}
|
||||
|
||||
// Safe connection that checks if the window still exists
|
||||
Connections {
|
||||
target: NightLightService
|
||||
function onIsActiveChanged() {
|
||||
if (nightlightWindow && typeof nightlightWindow.visible !== 'undefined') {
|
||||
nightlightWindow.visible = NightLightService.isActive
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationSlow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup when component is being destroyed
|
||||
Component.onDestruction: {
|
||||
Logger.log("NightLight", "PanelWindow being destroyed")
|
||||
}
|
||||
}
|
||||
|
||||
// Safe state changes
|
||||
onActiveChanged: {
|
||||
if (!active) {
|
||||
Logger.log("NightLight", "Loader deactivating for screen:", modelData.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user