feat!: support exponential brightness curve

I don't need most of the fluff for handling other types of displays, and getting rid of it lets me do something a lot nicer: add an exponential-gamma brightness display.
This commit is contained in:
Kiana Sheibani 2026-01-25 04:45:00 -05:00
parent bc5d256073
commit e45f412930
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
9 changed files with 28 additions and 133 deletions

View file

@ -11,7 +11,6 @@ Item {
id: root
required property var uiState
required property Brightness.Monitor monitor
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
@ -95,13 +94,10 @@ Item {
implicitHeight: Config.osd.sliderLength
function onWheel(event: WheelEvent) {
const monitor = root.monitor;
if (!monitor)
return;
if (event.angleDelta.y > 0)
monitor.setBrightness(monitor.brightness + 0.1);
Brightness.setBrightness(Brightness.brightness + 0.1);
else if (event.angleDelta.y < 0)
monitor.setBrightness(monitor.brightness - 0.1);
Brightness.setBrightness(Brightness.brightness - 0.1);
}
CustomFilledSlider {
@ -109,8 +105,8 @@ Item {
color: Config.colors.brightness
icon: Icons.getBrightnessIcon(value)
value: root.monitor?.brightness ?? 0
onMoved: root.monitor?.setBrightness(value)
value: Brightness.brightness
onMoved: Brightness.setBrightness(value)
}
}
}

View file

@ -7,10 +7,8 @@ Scope {
id: root
required property PersistentProperties uiState
required property ShellScreen screen
required property bool hovered
required property bool suppressed
readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(screen)
function show(): void {
if (!root.suppressed) {
@ -34,7 +32,7 @@ Scope {
}
Connections {
target: root.monitor
target: Brightness
function onBrightnessChanged(): void {
if (root.uiState.osdBrightnessReact)

View file

@ -8,7 +8,6 @@ Item {
id: root
required property var uiState
required property ShellScreen screen
visible: width > 0
implicitWidth: 0
@ -61,6 +60,5 @@ Item {
id: content
uiState: root.uiState
monitor: Brightness.getMonitorForScreen(root.screen)
}
}