fix: show ethernet connection in network widget#2426
fix: show ethernet connection in network widget#2426ultherego wants to merge 9 commits intonoctalia-dev:mainfrom
Conversation
| } | ||
| } | ||
|
|
||
| NBox { |
| Item { | ||
| Layout.fillHeight: true | ||
| } | ||
| Item { Layout.fillHeight: true } |
There was a problem hiding this comment.
This format change is out of style with the rest of the code. Also not sure why you are deleting so many comments
| // Mode switch (Wi‑Fi / Ethernet) | ||
| NTabBar { | ||
| id: modeTabBar | ||
| visible: NetworkService.ethernetAvailable && NetworkService.wifiAvailable |
There was a problem hiding this comment.
I'm not a fan of having the tab bar always visible. I only use the widget for wifi and have no ethernet port, so this seems like unnecessary clutter.
There was a problem hiding this comment.
I agree with that, I don't have Wi-Fi and it's visible in the widget. In this case, anything not in use should be hidden.
There was a problem hiding this comment.
I agree with that, I don't have Wi-Fi and it's visible in the widget. In this case, anything not in use should be hidden.
It was the default before i even involved in it, i kept it as is.
not my skill issue this time 😃
Though this tab bar can be better
maybe (wifi || eth) && vpn
| // - If Wi-Fi is actively connected, open Wi-Fi first | ||
| // - Otherwise always open Ethernet first | ||
| // VPN is manual-only and should not be auto-selected | ||
| if (NetworkService.wifiConnected) { |
There was a problem hiding this comment.
This doesn't make sense on devices that have no ethernet port. There is a problem in the current opening logic that the ethernet tab is not shown if ethernet is connected but the last view was Wi-Fi and Wi-Fi is disabled, but this can be solved with this:
onOpened: {
// Restore last view if valid, otherwise choose what's available (prefer Wi‑Fi when both exist)
const last = Settings.data.network.networkPanelView;
if (NetworkService.ethernetAvailable && (last === "ethernet" || !NetworkService.wifiEnabled)) {
panelViewMode = "ethernet";
} else {
panelViewMode = "wifi";
}
panelViewPersistEnabled = true;
}
|
How it currently works:
The tab is always primary.
The tab is visible, but launching the widget automatically sets Wi-Fi as primary.
This is a different condition than Wi-Fi/Ethernet — those depend on the presence of a physical adapter, while VPN depends on the presence of a configuration (connection profile). |
| // Whether VPN configurations exist (tab only shown when true) | ||
| readonly property bool vpnAvailable: Object.keys(VPNService.connections).length > 0 | ||
|
|
||
| // If VPN configs vanish while on VPN tab, switch away | ||
| onVpnAvailableChanged: { | ||
| if (!vpnAvailable && panelViewMode === "vpn") { | ||
| panelViewMode = NetworkService.wifiAvailable ? "wifi" : "ethernet"; | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
This would supposed to be in VPNService?
Retrieved/used within connections block or if (VPNService.x)
| } else { | ||
| panelViewMode = "wifi"; | ||
| } | ||
| panelViewMode = "wifi"; // fallback (shows empty/disabled state) |
There was a problem hiding this comment.
On a second thought wifi as fallback questionable choice.
Do you think ethernet fits better?
|
|
||
| // VPN empty state | ||
| NBox { | ||
| visible: panelViewMode === "vpn" && Object.keys(VPNService.connections).length === 0 |
There was a problem hiding this comment.
I cannot try atm and rest of the day.
But have a question, empty view of vpn has no purpose i can think of...
If you want to dig further i do not tried vpns on linux/network manager we may can use deviceStatusProcess would super-seed entire VPNService :P Honestly l don't know why i didn't do/tried doing this before. |
Tested it — NM does create virtual interfaces (tun0 for OpenVPN, wg0 for WireGuard), and deviceStatusProcess sees them. However it can't replace VPNService because the interface only exists while VPN is active. Inactive VPN configs are invisible to So deviceStatusProcess could complement VPNService (detect active VPN state, IP, DNS for bar icon etc.) but can't supersede it — we still need |
| panelViewMode = "wifi"; | ||
| } else if (NetworkService.ethernetAvailable) { | ||
| panelViewMode = "ethernet"; | ||
| } else if (VPNService.hasConnections) { |
There was a problem hiding this comment.
There needs to be an additional NetworkService.wifiAvailable check after the VPN check; if I disable wifi it opens the ethernet panel for me and i can't use the panel to enable wifi again!
Also, if you are removing the use of Settings.data.network.networkPanelView you should delete all references to it and panelViewPersistEnabled in the code. Settings have to be removed from settings.qml and settings-default.json as well.
There was a problem hiding this comment.
Good points, thanks for checking. I’ll push the fixes over the weekend and try to analyze it.
Additionally, I encountered an issue myself:
The widget was constantly enabled
I unplugged the Wi-Fi USB
I received a notification about it being unavailable
I plugged the Wi-Fi USB back in — the Wi-Fi unavailable view remained; only reopening the widget updated it
| } | ||
|
|
||
| Timer { | ||
| id: _monitorDebounce |
There was a problem hiding this comment.
We do need this? onRead only triggers when nmcli prints
| _monitorDebounce.stop(); | ||
| deviceStatusProcess.running = true; | ||
| connectivityCheckProcess.running = true; | ||
| } else if (data.endsWith(": unavailable") || data.endsWith(": unmanaged") || data.indexOf(": device removed") !== -1 || data.indexOf(": device created") !== -1) { |
There was a problem hiding this comment.
We should not bother with unmanaged devices.
There was a problem hiding this comment.
I was in the process of checking what else was left to remove, etc.
There was a problem hiding this comment.
looking for something to remove? - See this
Was replacing Processes with quickshell API/Methods. - Whats left atm connectProcess
…, remove redundant toast workaround, fix modeTabBar reference error
|
There are some layout problems with the current version, in part because you copied from the ethernet layout which also has problems (the reference layout at the moment is the Wi-Fi view). Since there are a lot of changes, I've edited the current NetworkPanel.qml in your PR and pasted it here: https://pastebin.com/bmQdvaJP
|
|
Thank you for taking a look at this.
Another thing: I see you changed the logic of the connect/disconnect button in the VPN. I’m not sure if that’s a good idea, because they disappear for all items while they’re being used. Sometimes someone connects to several at once and just clicks connect/disconnect on selected ones simultaneously (it’s more about convenience than necessity). The rest of the changes seem reasonable to me, thanks a lot 👍 |
The connect/disconnect button only disappear for the VPN connection that's currently connecting/disconnecting. I've just copied the logic from the Wi-Fi tab. You can keep the For the VPN refresh: There exists a VPN widget for the bar and I think the refreshTimer might be necessary to keep it updated. |
…delegates, fix margins and anchors Apply notiant's layout review: unified getContentColors()/forceOpaque pattern for ethernet and VPN delegates, consistent margins (marginL/marginM), proper anchors, removed badge pill. VPN connect/disconnect buttons use enabled (not visible) to prevent layout jumps while blocking concurrent operations.
|
I changed it to |



Pull Request
If this PR is not ready for review yet, please mark it as Draft until it's good to be reviewed.
Motivation
Fix Ethernet connection not being displayed in the network widget after recent networking changes. The issue occurs even when a wired connection is active and working correctly.
Type of Change
Mark the relevant option with an "x".
Related Issue
Testing
Describe how you tested your changes and mark the relevant items.
Screenshots / Videos
Checklist
Additional Notes
This change restores Ethernet (wired) connection visibility in the network widget while keeping existing Wi-Fi behavior unchanged.
Handles wired connections from NetworkManager and ensures they are properly reflected in the widget state.