Making Network via singleton
This commit is contained in:
@@ -3,6 +3,7 @@ import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import "../../../colors"
|
||||
import "../states/Network" as Global
|
||||
|
||||
MouseArea {
|
||||
id: networkButton
|
||||
@@ -13,7 +14,8 @@ MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
onClicked: {
|
||||
networkStatus.running = true
|
||||
Global.NetworkState.networkScript.start()
|
||||
// networkStatus.running = true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -26,30 +28,31 @@ MouseArea {
|
||||
|
||||
Text {
|
||||
id: networkText
|
||||
text: Global.NetworkState.status
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 26
|
||||
font.family: "Nerd Font"
|
||||
color: networkButton.containsMouse ? Colors.tertiary_fg : networkText.text === " /" ? Colors.error : Colors.primary
|
||||
}
|
||||
|
||||
Process {
|
||||
id: networkStatus
|
||||
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/bar/scripts/Network.sh"]
|
||||
running: true
|
||||
// Process {
|
||||
// id: networkStatus
|
||||
// command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/bar/scripts/Network.sh"]
|
||||
// running: true
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
networkText.text = this.text.trim()
|
||||
// console.log("networkScript networkText:", this.text.trim())
|
||||
}
|
||||
}
|
||||
}
|
||||
// stdout: StdioCollector {
|
||||
// onStreamFinished: {
|
||||
// networkText.text = this.text.trim()
|
||||
// // console.log("networkScript networkText:", this.text.trim())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Timer {
|
||||
interval: 10000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: networkStatus.running = true
|
||||
}
|
||||
// Timer {
|
||||
// interval: 10000
|
||||
// running: true
|
||||
// repeat: true
|
||||
// onTriggered: networkStatus.running = true
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user