Files
dotfiles/quickshell/VolumeWidget.qml
2026-05-18 08:19:40 +02:00

51 lines
1.2 KiB
QML

import QtQuick
import Quickshell.Io
// eww volume-widget
Rectangle {
id: root
property string volumeInfo: ""
readonly property bool muted: volumeInfo.startsWith("muted")
readonly property int level: parseInt(volumeInfo) || 0
readonly property string icon:
muted ? "󰝟" :
level < 34 ? "󰕿" :
level < 67 ? "󰖀" : "󰕾"
implicitWidth: row.implicitWidth + 16
implicitHeight: 22
radius: 11
color: "#313244"
Row {
id: row
anchors.centerIn: parent
spacing: 4
Text {
text: root.icon
color: "#cdd6f4"
font.pixelSize: 13
}
Text {
text: root.muted ? "Muted" : root.level + "%"
color: "#cdd6f4"
font.pixelSize: 12
font.family: "monospace"
}
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.createQmlObject(
'import Quickshell.Io; Process { command: ["bash","' +
Qt.resolvedUrl("scripts/toggle-mixer.sh") +
'"]; running: true }', root)
}
cursorShape: Qt.PointingHandCursor
}
}