Fixed that Idle indicator updates on multiple screens
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
property int idle: 0
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
singleton IdleState 1.0 IdleState.qml
|
||||
@@ -3,6 +3,7 @@ import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import "../../../colors"
|
||||
import "../states" 1.0 as Global
|
||||
|
||||
MouseArea {
|
||||
id: idleButton
|
||||
@@ -15,8 +16,6 @@ MouseArea {
|
||||
idleStatusScript.running = true
|
||||
}
|
||||
|
||||
property int idle: 0
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: idleButton.containsMouse ? Colors.tertiary : Qt.alpha(Colors.tertiaryContainer, 0.25)
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import "../../../colors"
|
||||
|
||||
MouseArea {
|
||||
@@ -10,6 +11,10 @@ MouseArea {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
onClicked: {
|
||||
archButtonScript.running = true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: archButton.containsMouse ? Colors.tertiary : Qt.alpha(Colors.primaryContainer, 0.25)
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user