Files
illogical-impulse/.config/quickshell/modules/sidebarRight/quickToggles/NightLight.qml
T
月月 b32734b9f5 Quickshell qstr seems not to be working, trying to implement custom translation
Add Chinese (zh_CN) translations for Quickshell interface and settings
2025-06-17 12:54:22 +08:00

44 lines
1.0 KiB
QML

import "root:/modules/common"
import "root:/modules/common/widgets"
import "../"
import "root:/services/"
import Quickshell.Io
import Quickshell
QuickToggleButton {
id: nightLightButton
property bool enabled: false
toggled: enabled
buttonIcon: "nightlight"
onClicked: {
nightLightButton.enabled = !nightLightButton.enabled
if (enabled) {
nightLightOn.startDetached()
}
else {
nightLightOff.startDetached()
}
}
Process {
id: nightLightOn
command: ["gammastep"]
}
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
}
}
}
StyledToolTip {
content: Translation.tr("Night Light")
}
}