Add gamma slider to night light dialog

This commit is contained in:
altrup
2026-03-22 18:02:00 -04:00
parent a28ed6023e
commit fc7524a30f
2 changed files with 31 additions and 4 deletions
@@ -42,6 +42,7 @@ Rectangle {
sourceComponent: QuickSlider {
materialSymbol: "light_mode"
secondaryMaterialSymbol: "wb_twilight"
stopIndicatorValues: Hyprsunset.gamma !== 100 && root.brightnessMonitor.brightness !== 0 ? [0.3 + root.brightnessMonitor.brightness * 0.7] : []
value: Hyprsunset.gamma === 100? 0.3 + root.brightnessMonitor.brightness * 0.7 : Hyprsunset.gamma / 100 * 0.3
tooltipContent: Hyprsunset.gamma === 100 ? `${Math.round(root.brightnessMonitor.brightness * 100)}%` : `${Hyprsunset.gamma}%`
onMoved: {
@@ -15,7 +15,7 @@ WindowDialog {
id: root
property var screen: root.QsWindow.window?.screen
property var brightnessMonitor: Brightness.getMonitorForScreen(screen)
backgroundHeight: 600
backgroundHeight: 700
WindowDialogTitle {
text: Translation.tr("Eye protection")
@@ -146,6 +146,33 @@ WindowDialog {
id: brightnessColumn
Layout.topMargin: -16
Layout.fillWidth: true
WindowDialogSlider {
anchors {
left: parent.left
right: parent.right
leftMargin: 4
rightMargin: 4
}
value: root.brightnessMonitor.brightness
onMoved: root.brightnessMonitor.setBrightness(value)
}
}
WindowDialogSectionHeader {
text: Translation.tr("Gamma")
}
WindowDialogSeparator {
Layout.topMargin: -22
Layout.leftMargin: 0
Layout.rightMargin: 0
}
Column {
id: gammaColumn
Layout.topMargin: -16
Layout.fillWidth: true
Layout.fillHeight: true
WindowDialogSlider {
@@ -155,9 +182,8 @@ WindowDialog {
leftMargin: 4
rightMargin: 4
}
// text: Translation.tr("Brightness")
value: root.brightnessMonitor.brightness
onMoved: root.brightnessMonitor.setBrightness(value)
value: Hyprsunset.gamma / 100
onMoved: Hyprsunset.setGamma(value * 100)
}
}