51 lines
1.2 KiB
QML
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
|
|
}
|
|
}
|