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()
|
||||
}
|
||||
|
||||
property string _pendingState: "disconnected"
|
||||
property string _pendingConn: ""
|
||||
property string _pendingType: ""
|
||||
property string _pendingDevice: ""
|
||||
|
||||
function refreshNet() {
|
||||
netWidget.netState = "disconnected";
|
||||
netWidget.netConn = "";
|
||||
netWidget.netIcon = netWidget.netType === "wifi" ? "\u{f05aa}" : "\u{f0201}";
|
||||
netWidget._pendingState = "disconnected";
|
||||
netWidget._pendingConn = "";
|
||||
netWidget._pendingType = "";
|
||||
netProc.running = true;
|
||||
}
|
||||
|
||||
|
|
@ -612,13 +617,25 @@ in
|
|||
let conn = fields[3];
|
||||
if (type !== "ethernet" && type !== "wifi") return;
|
||||
if (type === "wifi") {
|
||||
netWidget.netDevice = fields[0];
|
||||
netWidget._pendingDevice = fields[0];
|
||||
}
|
||||
if (state === "connected") {
|
||||
netWidget.netState = "connected";
|
||||
netWidget.netConn = conn;
|
||||
netWidget.netType = type;
|
||||
netWidget.netIcon = type === "wifi" ? "\u{f05a9}" : "\u{f0200}";
|
||||
netWidget._pendingState = "connected";
|
||||
netWidget._pendingConn = conn;
|
||||
netWidget._pendingType = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
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