57 lines
1.8 KiB
QML
57 lines
1.8 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Io
|
|
import "../../../colors"
|
|
|
|
MouseArea {
|
|
id: networkButton
|
|
width: output.width + 16
|
|
height: bar.height
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
// onClicked: {
|
|
// console.log("Wifi Hardware:", Networking.wifiHardwareEnabled)
|
|
// console.log("Wifi:", Networking.wifiEnabled)
|
|
// console.log("Device Type:", Networking.devices.DeviceType.toString(DeviceType))
|
|
// console.log("Device Type:", Networking.devices.DeviceConnectionState.toString(DeviceConnectionState)) // ???
|
|
// console.log("Device Type:", Networking.devices.toString(NetworkDevice))
|
|
// console.log("Device Type:", Networking.devices.length)
|
|
// }
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: networkButton.containsMouse ? Colors.tertiary : Qt.alpha(Colors.tertiaryContainer, 0.25)
|
|
radius: 6
|
|
width: output.width + 16
|
|
|
|
Text {
|
|
id: output
|
|
anchors.centerIn: parent
|
|
font.pixelSize: 26
|
|
font.family: "Nerd Font"
|
|
color: networkButton.containsMouse ? Colors.tertiary_fg : output.text === " /" ? Colors.error : Colors.primary
|
|
}
|
|
|
|
Process {
|
|
id: networkStatus
|
|
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/bar/scripts/Network.sh"]
|
|
running: true
|
|
|
|
stdout: StdioCollector {
|
|
onStreamFinished: {
|
|
output.text = this.text.trim()
|
|
console.log("networkScript output:", this.text.trim())
|
|
}
|
|
}
|
|
}
|
|
|
|
Timer {
|
|
interval: 10000
|
|
running: true
|
|
repeat: true
|
|
onTriggered: networkStatus.running = true
|
|
}
|
|
}
|
|
} |