repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

quickshell/nugu/BarButton.qml

Raw
import QtQuick

Item {
    id: root

    required property QtObject theme
    property string text: ""
    property bool active: false
    property bool muted: false
    property string tooltip: ""

    signal activated()

    // A single primitive keeps bar widgets visually consistent and avoids every
    // status module inventing its own hover/active colors.
    implicitWidth: label.implicitWidth + 14
    implicitHeight: 22

    Rectangle {
        anchors.fill: parent
        radius: 7
        color: root.active ? root.theme.ui.focus : (mouse.containsMouse ? root.theme.ui.accent : "transparent")
    }

    Text {
        id: label
        anchors.centerIn: parent
        text: root.text
        color: root.active || mouse.containsMouse
            ? root.theme.content.backdrop
            : (root.muted ? root.theme.ui.minor : root.theme.ui.normal)
        font.family: "IBM Plex Mono"
        font.pixelSize: 12
        font.bold: root.active
        font.features: { "tnum": 1 }
    }

    MouseArea {
        id: mouse
        anchors.fill: parent
        hoverEnabled: true
        acceptedButtons: Qt.LeftButton
        onClicked: root.activated()
    }
}