mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
add click-to-mute on app icons in the volume mixer
This commit is contained in:
+43
-10
@@ -5,6 +5,7 @@ import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -20,19 +21,51 @@ Item {
|
||||
anchors.fill: parent
|
||||
spacing: 6
|
||||
|
||||
Image {
|
||||
Item {
|
||||
property real size: 36
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
visible: source != ""
|
||||
sourceSize.width: size
|
||||
sourceSize.height: size
|
||||
source: {
|
||||
let icon;
|
||||
icon = AppSearch.guessIcon(root.node?.properties["application.icon-name"] ?? "");
|
||||
if (AppSearch.iconExists(icon))
|
||||
Layout.preferredWidth: size
|
||||
Layout.preferredHeight: size
|
||||
|
||||
Image {
|
||||
id: iconImg
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
sourceSize.width: parent.size
|
||||
sourceSize.height: parent.size
|
||||
source: {
|
||||
let icon;
|
||||
icon = AppSearch.guessIcon(root.node?.properties["application.icon-name"] ?? "");
|
||||
if (AppSearch.iconExists(icon))
|
||||
return Quickshell.iconPath(icon, "image-missing");
|
||||
icon = AppSearch.guessIcon(root.node?.properties["node.name"] ?? "");
|
||||
return Quickshell.iconPath(icon, "image-missing");
|
||||
icon = AppSearch.guessIcon(root.node?.properties["node.name"] ?? "");
|
||||
return Quickshell.iconPath(icon, "image-missing");
|
||||
}
|
||||
}
|
||||
|
||||
Desaturate {
|
||||
anchors.fill: iconImg
|
||||
source: iconImg
|
||||
desaturation: root.node?.audio.muted ? 1.0 : 0.0
|
||||
visible: iconImg.source != ""
|
||||
opacity: root.node?.audio.muted ? 0.4 : 1.0
|
||||
|
||||
Behavior on opacity { NumberAnimation { duration: 150 } }
|
||||
Behavior on desaturation { NumberAnimation { duration: 150 } }
|
||||
}
|
||||
|
||||
MaterialSymbol {
|
||||
anchors.centerIn: parent
|
||||
visible: root.node?.audio.muted ?? false
|
||||
text: root.node?.isSink ? "volume_off" : "mic_off"
|
||||
font.pixelSize: 22
|
||||
color: Appearance.colors.colError
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.node.audio.muted = !root.node.audio.muted
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user