nosignal-shell/modules/osd/Wrapper.qml
2 * r + 2 * t 14437cc1ed fix: remove osd and session wrapper hacks
The panels are ignored if they are closed, so they don't produce bulges.
This does remove the sink effect on overshoot, but that didn't work
anyways. (also that change was part of the previous commit)
2026-03-27 19:03:55 +11:00

113 lines
2.8 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import qs.components
import qs.services
import qs.config
Item {
id: root
required property ShellScreen screen
required property DrawerVisibilities visibilities
required property bool sidebarOrSessionVisible
property bool hovered
readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(root.screen)
readonly property bool shouldBeActive: visibilities.osd && Config.osd.enabled && !(visibilities.utilities && Config.utilities.enabled)
property real offsetScale: shouldBeActive ? 0 : 1
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: offsetScale < 1
anchors.rightMargin: (-implicitWidth - 5) * offsetScale
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight
Behavior on offsetScale {
Anim {
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
}
Connections {
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;
}
target: Audio
}
Connections {
function onBrightnessChanged(): void {
root.show();
root.brightness = root.monitor?.brightness ?? 0;
}
target: root.monitor
}
Timer {
id: timer
interval: Config.osd.hideDelay
onTriggered: {
if (!root.hovered)
root.visibilities.osd = false;
}
}
Loader {
id: content
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
active: root.shouldBeActive || root.visible
sourceComponent: Content {
monitor: root.monitor
visibilities: root.visibilities
volume: root.volume
muted: root.muted
sourceVolume: root.sourceVolume
sourceMuted: root.sourceMuted
brightness: root.brightness
}
}
}