Skip to content

Fix network status after sleep - #154

Open
Abscissa24 wants to merge 4 commits into
mainfrom
Network-Status-Fix
Open

Fix network status after sleep#154
Abscissa24 wants to merge 4 commits into
mainfrom
Network-Status-Fix

Conversation

@Abscissa24

Copy link
Copy Markdown
Member

Fix network status after sleep

This bug has existed for a while now. When the system wakes up after going to sleep, the network symbol in the bar shows that there is no network/network is disconnected - even though there is a network connection. The dashboard widgets also falsely believed this. This PR fixes that bug.

Before

before Pasted image

After

image image

@Abscissa24 Abscissa24 linked an issue Aug 15, 2026 that may be closed by this pull request
@Abscissa24
Abscissa24 requested a review from LeVraiArdox August 16, 2026 07:36

@LeVraiArdox LeVraiArdox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, tho you might need to change some things. Keep in mind that we should avoid timers when we can.

Also, I think your update on the GitHub widget might be an error on your side.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is that related ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you might ask that. It fixes a bug.

Once the system wakes up from sleep, the network is registered as not connected, even though it is, and the dashboard widgets use their "not connected" states

After fixing the issue of the system not correctly refreshing the network state, everything works as intended and the widgets switch to their correct connected view

However, because they were initially using the "not connected" state, once the "connected" state is applied, the layout is messed up.

This is specific to the GithubWidget since other widgets have unified states, while the github calendar uses different dimensions for each state (connected/disconnected)

This is what the widget looks like without touching this file:

image

Because its trying to fit the correct state while the stale disconnected state's different layout is in use

Idk how much of sense that explanation makes but yeah

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks

Comment on lines +731 to +732
QTimer::singleShot(2000, this, [this]() { refreshAfterResume(); });
QTimer::singleShot(5000, this, [this]() { refreshAfterResume(); });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firing updates at 0s, 2s, and 5s hoping NM catches up in time is a band-aid. On a slow system or heavily loaded Wi-Fi card, 5 seconds might still not be enough.

Instead of random timers on login1 wake up, listen to NM's state changes. NM gives state updates (NM_CLIENT_STATE_CHANGED or property notifications on NMClient / NMDevice). When system resumes, NM updates its client state to NM_STATE_CONNECTED_GLOBAL or NM_DEVICE_STATE_ACTIVATED automatically. hook into that signal to refresh once NM is actually ready.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh that sounds good
Will fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network status after wake

2 participants