summaryrefslogtreecommitdiff
path: root/modules/osd/Wrapper.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-17 19:46:42 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-17 19:46:42 +1000
commitc48f411bcbc34afca9cdef713ef020767bd08430 (patch)
treeaccc4ea1dda5e4e6f634f5fe215e842940b1fe87 /modules/osd/Wrapper.qml
parentnotifs: fix dnd (diff)
downloadcaelestia-shell-c48f411bcbc34afca9cdef713ef020767bd08430.tar.gz
caelestia-shell-c48f411bcbc34afca9cdef713ef020767bd08430.tar.bz2
caelestia-shell-c48f411bcbc34afca9cdef713ef020767bd08430.zip
osd: fix anim when appear on change
Diffstat (limited to 'modules/osd/Wrapper.qml')
-rw-r--r--modules/osd/Wrapper.qml71
1 files changed, 70 insertions, 1 deletions
diff --git a/modules/osd/Wrapper.qml b/modules/osd/Wrapper.qml
index d4fae76..0e37edc 100644
--- a/modules/osd/Wrapper.qml
+++ b/modules/osd/Wrapper.qml
@@ -11,6 +11,27 @@ Item {
required property ShellScreen screen
required property var visibilities
+ property bool hovered
+ readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(root.screen)
+
+ property real volume
+ property bool muted
+ property real sourceVolume
+ property bool sourceMuted
+ property real brightness
+
+ function show(): void {
+ visibilities.osd = true;
+ timer.restart();
+ }
+
+ Component.onCompleted: {
+ volume = Audio.volume;
+ muted = Audio.muted;
+ sourceVolume = Audio.sourceVolume;
+ sourceMuted = Audio.sourceMuted;
+ brightness = root.monitor?.brightness ?? 0;
+ }
visible: width > 0
implicitWidth: 0
@@ -48,6 +69,49 @@ Item {
}
]
+ Connections {
+ target: Audio
+
+ function onMutedChanged(): void {
+ root.show();
+ root.muted = Audio.muted;
+ }
+
+ function onVolumeChanged(): void {
+ root.show();
+ root.volume = Audio.volume;
+ }
+
+ function onSourceMutedChanged(): void {
+ root.show();
+ root.sourceMuted = Audio.sourceMuted;
+ }
+
+ function onSourceVolumeChanged(): void {
+ root.show();
+ root.sourceVolume = Audio.sourceVolume;
+ }
+ }
+
+ Connections {
+ target: root.monitor
+
+ function onBrightnessChanged(): void {
+ root.show();
+ root.brightness = root.monitor?.brightness ?? 0;
+ }
+ }
+
+ Timer {
+ id: timer
+
+ interval: Config.osd.hideDelay
+ onTriggered: {
+ if (!root.hovered)
+ root.visibilities.osd = false;
+ }
+ }
+
Loader {
id: content
@@ -57,8 +121,13 @@ Item {
Component.onCompleted: active = Qt.binding(() => (root.visibilities.osd && Config.osd.enabled) || root.visible)
sourceComponent: Content {
- monitor: Brightness.getMonitorForScreen(root.screen)
+ monitor: root.monitor
visibilities: root.visibilities
+ volume: root.volume
+ muted: root.muted
+ sourceVolume: root.sourceVolume
+ sourceMuted: root.sourceMuted
+ brightness: root.brightness
}
}
}