1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

brightness: add udev monitor, bind OSDs to netlink events

fixes #863
This commit is contained in:
bbedward
2025-12-01 11:54:20 -05:00
parent 94851a51aa
commit e5d11ce535
11 changed files with 553 additions and 42 deletions

View File

@@ -107,7 +107,6 @@ DankOSD {
}
thumbOutlineColor: Theme.surfaceContainer
alwaysShowValue: SettingsData.osdAlwaysShowValue
value: !isDragging ? root.targetBrightness : value
onSliderValueChanged: newValue => {
if (DisplayService.brightnessAvailable) {
@@ -119,6 +118,11 @@ DankOSD {
onContainsMouseChanged: {
setChildHovered(containsMouse);
}
Binding on value {
value: root.targetBrightness
when: !brightnessSlider.isDragging
}
}
}
}
@@ -163,7 +167,12 @@ DankOSD {
y: gap * 2 + Theme.iconSize
property bool dragging: false
property int value: !dragging ? root.targetBrightness : value
property int value: 50
Binding on value {
value: root.targetBrightness
when: !vertSlider.dragging
}
readonly property int minimum: {
const deviceInfo = DisplayService.getCurrentDeviceInfo();
@@ -255,12 +264,14 @@ DankOSD {
}
function updateBrightness(mouse) {
if (DisplayService.brightnessAvailable) {
const ratio = 1.0 - (mouse.y / height);
const newValue = Math.round(vertSlider.minimum + ratio * (vertSlider.maximum - vertSlider.minimum));
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true);
resetHideTimer();
if (!DisplayService.brightnessAvailable) {
return;
}
const ratio = 1.0 - (mouse.y / height);
const newValue = Math.round(vertSlider.minimum + ratio * (vertSlider.maximum - vertSlider.minimum));
vertSlider.value = newValue;
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true);
resetHideTimer();
}
}
}