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.
52 lines
1 KiB
QML
52 lines
1 KiB
QML
import qs.services
|
|
import qs.config
|
|
import Quickshell
|
|
import QtQuick
|
|
|
|
Scope {
|
|
id: root
|
|
|
|
required property PersistentProperties uiState
|
|
required property bool hovered
|
|
required property bool suppressed
|
|
|
|
function show(): void {
|
|
if (!root.suppressed) {
|
|
root.uiState.osd = true;
|
|
timer.restart();
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
target: Audio
|
|
|
|
function onMutedChanged(): void {
|
|
if (root.uiState.osdVolumeReact)
|
|
root.show();
|
|
}
|
|
|
|
function onVolumeChanged(): void {
|
|
if (root.uiState.osdVolumeReact)
|
|
root.show();
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
target: Brightness
|
|
|
|
function onBrightnessChanged(): void {
|
|
if (root.uiState.osdBrightnessReact)
|
|
root.show();
|
|
}
|
|
}
|
|
|
|
Timer {
|
|
id: timer
|
|
|
|
interval: Config.osd.hideDelay
|
|
onTriggered: {
|
|
if (!root.hovered)
|
|
root.uiState.osd = false;
|
|
}
|
|
}
|
|
}
|