[Guide] Solution for WiFi problems after hibernate (non-systemd)

I noticed my WiFi module (mt7921e) was not functioning every time my Framework 16 woke from hibernation and I had no internet. I use Artix, which is a systemd-free flavor of Arch. I found out that you can make pre-post sleep scripts in /etc/elogind/system-sleep. I made one to disable my WiFi module pre-hibernation and enable post-hibernation. In systemd it’s also doable, see man systemd-suspend.service



# This script is for non-systemd based systems.
# You should place this script in '/etc/elogind/system-sleep' and make it executable.
# See 'man 1 loginctl', section 'Hook directories' for more information.
# Some devices do not function after hibernate, this script can solve that problem.
# It disables kernel module(s) pre-hibernate and enables kernel module(s) post-hibernate.
# You can add "hybrid-sleep" in the script too, if you use that.
# Module name(s): see output of 'lspci -knn'. Change below value to match your system.
# Add more modules if needed (and in the script below too).

case "$1 $2" in
  "pre hibernate" | "pre suspend-then-hibernate")
    modprobe -r $WiFiModule
  "post hibernate" | "post suspend-then-hibernate")
    modprobe $WiFiModule

Thanks for this! This works with systemd in Fedora 40.
The script goes here /usr/lib/systemd/system-sleep like it says in the man page.