import QtQuick
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
import "../../../colors"

MouseArea {
    id: archButton
    width: 30
    height: 28
    hoverEnabled: true
    cursorShape: Qt.PointingHandCursor

    onClicked: {
        archButtonScript.running = true
    }
    
    Rectangle {
        anchors.fill: parent
        color: archButton.containsMouse ? Colors.tertiary : Qt.alpha(Colors.primaryContainer, 0.25)
        radius: 6

        Text {
            anchors.centerIn: parent
            text: "󰣇"
            font.pixelSize: 26
            font.family: "Nerd Font"
            color: archButton.containsMouse ? Colors.tertiary_fg : Colors.primary
        }
    }

    Process {
        id: archButtonScript
        command: ["sh", "-c", "wofi --show drun"]
        running: false

        stdout: StdioCollector {
            onStreamFinished: {
                console.log("Opening wofi")
            }
        }
    }
}