forked from Shinonome/dots-hyprland
sidebar: night light dialog
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
import qs
|
||||
import qs.services
|
||||
import qs.modules.common
|
||||
import qs.modules.common.widgets
|
||||
import qs.modules.common.functions
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Io
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Hyprland
|
||||
|
||||
WindowDialog {
|
||||
id: root
|
||||
property var screen: root.QsWindow.window?.screen
|
||||
property var brightnessMonitor: Brightness.getMonitorForScreen(screen)
|
||||
|
||||
WindowDialogTitle {
|
||||
text: Translation.tr("Eye protection")
|
||||
}
|
||||
|
||||
WindowDialogSectionHeader {
|
||||
text: Translation.tr("Night Light")
|
||||
}
|
||||
|
||||
WindowDialogSeparator {
|
||||
Layout.topMargin: -22
|
||||
Layout.leftMargin: 0
|
||||
Layout.rightMargin: 0
|
||||
}
|
||||
|
||||
Column {
|
||||
id: nightLightColumn
|
||||
Layout.topMargin: -16
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
ConfigSwitch {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
iconSize: Appearance.font.pixelSize.larger
|
||||
buttonIcon: "lightbulb"
|
||||
text: Translation.tr("Enable now")
|
||||
checked: Hyprsunset.active
|
||||
onCheckedChanged: {
|
||||
Hyprsunset.toggle(checked)
|
||||
}
|
||||
}
|
||||
|
||||
ConfigSwitch {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
iconSize: Appearance.font.pixelSize.larger
|
||||
buttonIcon: "night_sight_auto"
|
||||
text: Translation.tr("Automatic")
|
||||
checked: Config.options.light.night.automatic
|
||||
onCheckedChanged: {
|
||||
Config.options.light.night.automatic = checked;
|
||||
}
|
||||
}
|
||||
|
||||
WindowDialogSlider {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 4
|
||||
rightMargin: 4
|
||||
}
|
||||
text: Translation.tr("Color temperature")
|
||||
from: 1000
|
||||
to: 20000
|
||||
stopIndicatorValues: [6000, to]
|
||||
value: Config.options.light.night.colorTemperature
|
||||
onMoved: Config.options.light.night.colorTemperature = value
|
||||
tooltipContent: `${Math.round(value)}K`
|
||||
}
|
||||
}
|
||||
|
||||
WindowDialogSectionHeader {
|
||||
text: Translation.tr("Brightness")
|
||||
}
|
||||
|
||||
WindowDialogSeparator {
|
||||
Layout.topMargin: -22
|
||||
Layout.leftMargin: 0
|
||||
Layout.rightMargin: 0
|
||||
}
|
||||
|
||||
Column {
|
||||
id: brightnessColumn
|
||||
Layout.topMargin: -16
|
||||
Layout.fillWidth: true
|
||||
// Layout.fillHeight: true
|
||||
|
||||
WindowDialogSlider {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 4
|
||||
rightMargin: 4
|
||||
}
|
||||
// text: Translation.tr("Brightness")
|
||||
value: root.brightnessMonitor.brightness
|
||||
onMoved: root.brightnessMonitor.setBrightness(value)
|
||||
}
|
||||
}
|
||||
|
||||
WindowDialogButtonRow {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
DialogButton {
|
||||
buttonText: Translation.tr("Done")
|
||||
onClicked: root.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user