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

35 lines
833 B
QML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import QtQuick
// Generic stat pill matches eww stat-pill
Rectangle {
id: root
property string text: ""
property bool clickable: false
signal clicked()
signal rightClicked()
implicitWidth: lbl.implicitWidth + 16
implicitHeight: 22
radius: 11 // fully rounded pill
color: "#313244"
Text {
id: lbl
anchors.centerIn: parent
text: root.text
color: "#cdd6f4"
font.pixelSize: 12
font.family: "monospace"
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: (mouse) => {
if (mouse.button === Qt.RightButton) root.rightClicked()
else root.clicked()
}
cursorShape: root.clickable ? Qt.PointingHandCursor : Qt.ArrowCursor
}
}