Fix Wifi not working after Suspend [#ubuntu]

After installing Ubunutu on my new Xiaomi Book Air 12 I hit a new bug in network-manager in ubuntu which cause the fail off wifi connection after resume from suspend because the network-manager still sleep :)

It’s a long stand bug affected many brands in Linux to have a workaround just follow these simple steps.

1- Copy and paste in terminal:

sudo gedit /etc/systemd/system/wifi-resume.service

2- Copy this code and paste it in the file you opened:

#sudo systemctl enable wifi-resume.service
Description=Restart networkmanager at resume
ExecStart=wpa_cli resume
ExecStart=/bin/systemctl restart NetworkManager.service

3- Run this command in the terminal:

sudo systemctl enable wifi-resume.service


after applying these settings the wifi will be connected automatically after the resume but the network manager icon will still be not active and not showing any wifi or network.