54 lines
1.1 KiB
QML
54 lines
1.1 KiB
QML
import qs.services
|
|
import qs.config
|
|
import Quickshell
|
|
import QtQuick
|
|
|
|
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) {
|
|
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: root.monitor
|
|
|
|
function onBrightnessChanged(): void {
|
|
if (root.uiState.osdBrightnessReact)
|
|
root.show();
|
|
}
|
|
}
|
|
|
|
Timer {
|
|
id: timer
|
|
|
|
interval: Config.osd.hideDelay
|
|
onTriggered: {
|
|
if (!root.hovered)
|
|
root.uiState.osd = false;
|
|
}
|
|
}
|
|
}
|