diff --git a/modules/bar/states/IdleState.qml b/modules/bar/states/IdleState.qml new file mode 100644 index 0000000..ea95a07 --- /dev/null +++ b/modules/bar/states/IdleState.qml @@ -0,0 +1,6 @@ +pragma Singleton +import QtQuick + +QtObject { + property int idle: 0 +} \ No newline at end of file diff --git a/modules/bar/states/qmldir b/modules/bar/states/qmldir new file mode 100644 index 0000000..bb57934 --- /dev/null +++ b/modules/bar/states/qmldir @@ -0,0 +1 @@ +singleton IdleState 1.0 IdleState.qml \ No newline at end of file diff --git a/modules/bar/widgets/IdleButton.qml b/modules/bar/widgets/IdleButton.qml index a2a7ae2..92cf1b0 100644 --- a/modules/bar/widgets/IdleButton.qml +++ b/modules/bar/widgets/IdleButton.qml @@ -3,6 +3,7 @@ import Quickshell import Quickshell.Hyprland import Quickshell.Io import "../../../colors" +import "../states" 1.0 as Global MouseArea { id: idleButton @@ -14,8 +15,6 @@ MouseArea { Component.onCompleted: { idleStatusScript.running = true } - - property int idle: 0 Rectangle { anchors.fill: parent @@ -31,7 +30,7 @@ MouseArea { id: idleScript command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/bar/scripts/Idle.sh"] stdout: StdioCollector { - onStreamFinished: idleButton.idle ? console.log(`Disabling Idle`) : console.log(`Enabling Idle`) + onStreamFinished: Global.IdleState.idle ? console.log(`Disabling Idle`) : console.log(`Enabling Idle`) } } @@ -42,7 +41,8 @@ MouseArea { onClicked: { console.log("Running Idle Script") idleScript.startDetached() - idleButton.idle = !idleButton.idle + Global.IdleState.idle = !Global.IdleState.idle + console.log("Current Idle State: " + Global.IdleState.idle) } } } @@ -50,7 +50,7 @@ MouseArea { Text { id: idleText anchors.centerIn: parent - text: idleButton.idle ? "" : "" + text: Global.IdleState.idle ? "" : "" font.pixelSize: 26 font.family: "Nerd Font" color: idleButton.containsMouse ? Colors.tertiary_fg : idleText.text == "" ? Colors.primary : Colors.tertiary @@ -63,9 +63,7 @@ MouseArea { command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/bar/scripts/Idle.sh" + " --status"] stdout: StdioCollector { onStreamFinished: { - this.text.trim() === "0" ? idle = 1 : idle = 0 - console.log("networkScript networkText:", this.text.trim()) - console.log("networkScript") + Global.IdleState.idle = this.text.trim() === "0" ? 1 : 0 } } } diff --git a/modules/bar/widgets/MenuButton.qml b/modules/bar/widgets/MenuButton.qml index 4ad0533..b890675 100644 --- a/modules/bar/widgets/MenuButton.qml +++ b/modules/bar/widgets/MenuButton.qml @@ -1,6 +1,7 @@ import QtQuick import Quickshell import Quickshell.Hyprland +import Quickshell.Io import "../../../colors" MouseArea { @@ -9,6 +10,10 @@ MouseArea { height: 28 hoverEnabled: true cursorShape: Qt.PointingHandCursor + + onClicked: { + archButtonScript.running = true + } Rectangle { anchors.fill: parent @@ -23,4 +28,16 @@ MouseArea { 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") + } + } + } } \ No newline at end of file