From 39594baa4659af2ab0195a0c73f30351cc3c39ff Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 11 May 2025 11:06:19 +0200 Subject: [PATCH] bar: volume mute indicator --- .config/quickshell/modules/bar/Bar.qml | 42 ++++++++++++++++--- .../modules/common/widgets/Revealer.qml | 33 +++++++++++++++ 2 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 .config/quickshell/modules/common/widgets/Revealer.qml diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index 9783c4f3a..2f468618d 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -164,15 +164,45 @@ Scope { RowLayout { id: indicatorsRowLayout anchors.centerIn: parent - spacing: 15 + property real realSpacing: 15 + spacing: 0 - MaterialSymbol { - visible: Audio.source?.audio?.muted - text: "mic_off" - iconSize: Appearance.font.pixelSize.larger - color: Appearance.colors.colOnLayer0 + Revealer { + reveal: Audio.sink?.audio?.muted + Layout.fillHeight: true + Layout.rightMargin: reveal ? indicatorsRowLayout.realSpacing : 0 + Behavior on Layout.rightMargin { + NumberAnimation { + duration: Appearance.animation.elementMoveFast.duration + easing.type: Appearance.animation.elementMoveFast.type + easing.bezierCurve: Appearance.animation.elementMoveFast.bezierCurve + } + } + MaterialSymbol { + text: "volume_off" + iconSize: Appearance.font.pixelSize.larger + color: Appearance.colors.colOnLayer0 + } + } + Revealer { + reveal: Audio.source?.audio?.muted + Layout.fillHeight: true + Layout.rightMargin: reveal ? indicatorsRowLayout.realSpacing : 0 + Behavior on Layout.rightMargin { + NumberAnimation { + duration: Appearance.animation.elementMoveFast.duration + easing.type: Appearance.animation.elementMoveFast.type + easing.bezierCurve: Appearance.animation.elementMoveFast.bezierCurve + } + } + MaterialSymbol { + text: "mic_off" + iconSize: Appearance.font.pixelSize.larger + color: Appearance.colors.colOnLayer0 + } } MaterialSymbol { + Layout.rightMargin: indicatorsRowLayout.realSpacing text: (Network.networkName.length > 0 && Network.networkName != "lo") ? ( Network.networkStrength > 80 ? "signal_wifi_4_bar" : Network.networkStrength > 60 ? "network_wifi_3_bar" : diff --git a/.config/quickshell/modules/common/widgets/Revealer.qml b/.config/quickshell/modules/common/widgets/Revealer.qml new file mode 100644 index 000000000..eaac35e50 --- /dev/null +++ b/.config/quickshell/modules/common/widgets/Revealer.qml @@ -0,0 +1,33 @@ +import "root:/modules/common" +import QtQuick +import Quickshell + +/** + * Recreation of GTK revealer. Expects one single child. + */ +Item { + id: root + property bool reveal + property bool vertical: false + clip: true + + implicitWidth: (reveal || vertical) ? childrenRect.width : 0 + implicitHeight: (reveal || !vertical) ? childrenRect.height : 0 + + Behavior on implicitWidth { + enabled: !vertical + NumberAnimation { + duration: Appearance.animation.elementMoveFast.duration + easing.type: Appearance.animation.elementMoveFast.type + easing.bezierCurve: Appearance.animation.elementMoveFast.bezierCurve + } + } + Behavior on implicitHeight { + enabled: vertical + NumberAnimation { + duration: Appearance.animation.elementMoveFast.duration + easing.type: Appearance.animation.elementMoveFast.type + easing.bezierCurve: Appearance.animation.elementMoveFast.bezierCurve + } + } +}