Wi-fi disconnects switching to i3WM

I installed NixOS with KDE on my laptop. This morning I installed and configured i3WM. Interestingly enough, when I log into i3WM, my wi-fi, that is already configured and connected in KDE, doesn’t connect.
Is there a reason wi-fi doesn’t connect automatically when I log into i3WM?
I attempted to run nmtui and provided the password (SSDID was already prefilled) but it still didn’t connect.

Review the system journal (journalctl) for both scenarios, looking for differences relevant to WiFi. You should see many entries for WiFi connecting and your network stack being configured. Possibly you will see entries for WiFi disconnecting when you logout.

I am not familiar with how KDE manage networking, but I use i3 with WiFi daily.

Got it working with nmtui. I had to enter my password again. Not sure why it didn’t take the first time, or why I have to enter in again at all with it already configured in KDE using Networkmanager.

My system stores WiFi credentials in /etc/NetworkManager/system-connections/, which requires sudo to access.

nmtui might not automatically ask you to authenticate as an admin, consequently failing to write the credentials to that directory. (Or it is missing a tool to authenticate securely.) Probably it would still connect to WiFi that time, but the credentials are not saved and it will need them again next time. If you are seeing this problem, try sudo nmtui.

KDE (and its NetworkManager gui) might store the credentials somewhere else, such as in a gpg keychain.

You also might try running the KDE NetworkManager gui tool from within i3, if you can see how to find it.

Before switching to i3, I used xfce. My NetworkManager gui was installed using the nixos config line programs.nm-applet.enable = true;. This continues to work in i3, although I no longer have xfce installed. The panel widget appears in my i3 status bar. Clicking the widget icon opens its menu.