quickshell: fix network status flicker during refresh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8fe48557e4
commit
9954877379
1 changed files with 25 additions and 8 deletions
|
|
@ -593,10 +593,15 @@ in
|
||||||
onTriggered: netWidget.refreshNet()
|
onTriggered: netWidget.refreshNet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property string _pendingState: "disconnected"
|
||||||
|
property string _pendingConn: ""
|
||||||
|
property string _pendingType: ""
|
||||||
|
property string _pendingDevice: ""
|
||||||
|
|
||||||
function refreshNet() {
|
function refreshNet() {
|
||||||
netWidget.netState = "disconnected";
|
netWidget._pendingState = "disconnected";
|
||||||
netWidget.netConn = "";
|
netWidget._pendingConn = "";
|
||||||
netWidget.netIcon = netWidget.netType === "wifi" ? "\u{f05aa}" : "\u{f0201}";
|
netWidget._pendingType = "";
|
||||||
netProc.running = true;
|
netProc.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -612,13 +617,25 @@ in
|
||||||
let conn = fields[3];
|
let conn = fields[3];
|
||||||
if (type !== "ethernet" && type !== "wifi") return;
|
if (type !== "ethernet" && type !== "wifi") return;
|
||||||
if (type === "wifi") {
|
if (type === "wifi") {
|
||||||
netWidget.netDevice = fields[0];
|
netWidget._pendingDevice = fields[0];
|
||||||
}
|
}
|
||||||
if (state === "connected") {
|
if (state === "connected") {
|
||||||
netWidget.netState = "connected";
|
netWidget._pendingState = "connected";
|
||||||
netWidget.netConn = conn;
|
netWidget._pendingConn = conn;
|
||||||
netWidget.netType = type;
|
netWidget._pendingType = type;
|
||||||
netWidget.netIcon = type === "wifi" ? "\u{f05a9}" : "\u{f0200}";
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onRunningChanged: {
|
||||||
|
if (!running) {
|
||||||
|
netWidget.netState = netWidget._pendingState;
|
||||||
|
netWidget.netConn = netWidget._pendingConn;
|
||||||
|
netWidget.netType = netWidget._pendingType.length > 0 ? netWidget._pendingType : netWidget.netType;
|
||||||
|
netWidget.netDevice = netWidget._pendingDevice.length > 0 ? netWidget._pendingDevice : netWidget.netDevice;
|
||||||
|
if (netWidget.netState === "connected") {
|
||||||
|
netWidget.netIcon = netWidget.netType === "wifi" ? "\u{f05a9}" : "\u{f0200}";
|
||||||
|
} else {
|
||||||
|
netWidget.netIcon = netWidget.netType === "wifi" ? "\u{f05aa}" : "\u{f0201}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue