2

I am running Manjaro on a Microsoft Surface Pro 3 and I have issues with the Wifi not working after resuming from suspend. My current solution is to turn off the wifi radio using

nmcli radio wifi off

before I suspend, then turning it back on when I resume.

Is there anywhere I can put a script so that it will automatically run these commands adjacent to suspending/resuming?

1 Answer 1

1

You are most probably using Systemd thus have a look at the System sleep state logic. So you might drop a script into /usr/lib/systemd/system-sleep/ which runs the commands.

wifi-hack.sh

#!/bin/bash

if [ "${1}" == "pre" ]; then
   nmcli radio wifi off
elif [ "${1}" == "post" ]; then
   nmcli radio wifi on
fi

And make the script executable

sudo chmod +x /usr/lib/systemd/system-sleep/wifi-hack.sh

However be advised

Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ are intended for local use only and should be considered hacks. If applications want to react to system suspend/hibernation and resume, they should rather use the Inhibitor interface.

Thus have a look at Inhibitor interface do do the proper way.

2
  • This is exactly what I was looking for. I'll look into the Inhibitor interface.
    – Will
    Commented Sep 28, 2019 at 0:33
  • IMHO As you don't create an app I guess just putting the script there and you are fine.
    – papanito
    Commented Sep 28, 2019 at 6:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .