pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io

QtObject {
    id: root

    property string status: "..."
    property bool running: false

    // Timer property
    property Timer networkTimer: Timer {
        interval: 10000
        repeat: true
        running: true
        onTriggered: networkScript.running = true
    }

    // Process property
    property Process networkScript: Process {
        running: true
        command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/bar/scripts/Network.sh"]

        stdout: StdioCollector {
            onStreamFinished: {
                root.status = this.text.trim()
                // console.log("Network status:", root.status)
            }
        }
    }

    Component.onCompleted: {
        networkScript.running = true
        networkTimer.start()
    }
}