pop-os / cosmic-applets

WIP applets for cosmic-panel
GNU General Public License v3.0
215 stars 86 forks source link

[Bug Report] WiFi Does Not Reconnect on System Wake #643

Closed Dygear closed 3 weeks ago

Dygear commented 2 months ago

Cosmic-applets version: 0.1.0~1725375368~24.04~0b53634

Specific applet that this is regarding (if applicable): cosmic-applet-network

Issue/Bug description: When the system goes to sleep, or when the connection is dropped, the system does not automatically reconnect to the last WiFi connection it had.

Steps to reproduce:

  1. Put the system to sleep, and wake it up again. The system will not re-connect to the last WiFi connection.
  2. Disconnect power from the WiFi access point. The system will not re-connect when the WiFi SSID comes back online.
  3. Reboot the system. The system will not re-connect to the last WiFi SSID that it connected to.

Expected behavior: System should automatically reconnect to the last SSID it was connected to. Ideally this should also persist over system reboots, and not just sleep / wake events, or lost of access to the SSID due to power loss (on the access point side) or moving away from the signal source.

Other notes: Other systems will often pick the next best connection that it knows. That doesn't always produce an expected behavior for the user, that can sometimes be surprised when their laptop is suddenly connected to their Cellphone's Hotspot for several hours and didn't realize until their provider sent them a message about them being near their data limit. So for the moment, I think the best move forward would simply re-attempt a connection back to the same SSID as before.

Dygear commented 1 month ago

Writing down notes for myself, or someone else if they want to take this on.

In cosmic-applet-network/src/network_manager/mod.rs#L366 is has:

let s = Settings::new(s);

Settings is from cosmic_dbus_networkmanager::settings::connection that looks like it loads the known information about theconnection state from last time (so there is a database or settings file somewhere). ConnectionSettings's autoconnect value could be used, but that is dependent on WifiSettings is a inhearting of ConnectionSettings.

    ConnectionSettings,
    (auth_retries("auth-retries"): i32),
    (autoconnect("autoconnect"): bool),

Otherwise, we just add the autoconnect property to WifiSettings that defaults to true so when the connection manager loads the list of known connections it can look over the available SSIDs and the list of known SSID's and connect if the SSIDs match.

Dygear commented 3 weeks ago

This has been resolved. Thank you @wash2 for landing this in https://github.com/pop-os/cosmic-applets/commit/d1a6e089b4b87d6b8b4ee6b6759317f49af402ee.