mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
52 lines
1.2 KiB
QML
52 lines
1.2 KiB
QML
pragma Singleton
|
|
pragma ComponentBehavior: Bound
|
|
|
|
import Quickshell;
|
|
import Quickshell.Io;
|
|
import Quickshell.Services.Pipewire;
|
|
import QtQuick;
|
|
|
|
Singleton {
|
|
id: root
|
|
|
|
property int updateInterval: 1000
|
|
property string networkName: "";
|
|
property int networkStrength;
|
|
function update() {
|
|
updateNetworkName.running = true
|
|
updateNetworkStrength.running = true
|
|
}
|
|
|
|
Timer {
|
|
interval: 10
|
|
running: true
|
|
repeat: true
|
|
onTriggered: {
|
|
update()
|
|
interval = root.updateInterval;
|
|
}
|
|
}
|
|
|
|
Process {
|
|
id: updateNetworkName
|
|
command: ["sh", "-c", "nmcli -t -f NAME c show --active | head -1"]
|
|
running: true;
|
|
stdout: SplitParser {
|
|
onRead: data => {
|
|
root.networkName = data
|
|
}
|
|
}
|
|
}
|
|
|
|
Process {
|
|
id: updateNetworkStrength
|
|
running: true
|
|
command: ["sh", "-c", "nmcli -f IN-USE,SIGNAL,SSID device wifi | awk '/^\*/{if (NR!=1) {print $2}}'"];
|
|
stdout: SplitParser {
|
|
onRead: data => {
|
|
root.networkStrength = parseInt(data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|