night light: use hyprsunset <- gammastep

This commit is contained in:
end-4
2025-07-23 09:00:31 +07:00
parent 3d5ed9401c
commit 574a2a11e7
7 changed files with 148 additions and 35 deletions
@@ -1,41 +1,28 @@
import QtQuick
import qs.modules.common
import qs.modules.common.widgets
import qs
import qs.services
import Quickshell.Io
QuickToggleButton {
id: nightLightButton
property bool enabled: false
property bool enabled: Hyprsunset.active
toggled: enabled
buttonIcon: "nightlight"
buttonIcon: Config.options.light.night.automatic ? "night_sight_auto" : "bedtime"
onClicked: {
nightLightButton.enabled = !nightLightButton.enabled
if (enabled) {
nightLightOn.startDetached()
}
else {
nightLightOff.startDetached()
}
Hyprsunset.toggle()
}
Process {
id: nightLightOn
command: ["gammastep"]
altAction: () => {
Config.options.light.night.automatic = !Config.options.light.night.automatic
}
Process {
id: nightLightOff
command: ["pkill", "gammastep"]
}
Process {
id: updateNightLightState
running: true
command: ["pidof", "gammastep"]
stdout: SplitParser {
onRead: (data) => { // if not empty then set toggled to true
nightLightButton.enabled = data.length > 0
}
}
Component.onCompleted: {
Hyprsunset.fetchState()
}
StyledToolTip {
content: Translation.tr("Night Light")
content: Translation.tr("Night Light | Right-click to toggle Auto mode")
}
}