Fixed that Idle indicator updates on multiple screens
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user