Fix: Network Manager applet missing after suspend & resume (needed for wifi etc)

Problem:
Every time I resume the laptop from sleep the network manager applet is missing from the system tray. Need to connect to a new wifi? Have to start nmtui-connect from within sys-net :rage:

Solution:
Make dom0 restart nm-applet within sys-net via qvm-run on every resume. Works like a charm and should survive Qubes and sys-net updates.

Code for dom0:

mkdir /etc/systemd/system-sleep 2>/dev/null

sudo tee /etc/systemd/system-sleep/qubes-nmapplet-revive >/dev/null << 'EOF'
#!/bin/sh
# Restart nm-applet in sys-net after resume to make it visible again
[ "$1" = "post" ] || exit 0

if qvm-check --running sys-net >/dev/null 2>&1; then
    qvm-run sys-net 'pkill -x nm-applet'
    qvm-run --service sys-net qubes.StartApp+nm-applet
fi
EOF

sudo chmod +x /etc/systemd/system-sleep/qubes-nmapplet-revive

Addendum:
For testing you can trigger the missing nm-applet by restarting xfce4-panel in dom0: pskill xfce4-panel; xfce4-panel& and it’s gone

Hope this helps somebody, cheers finbob

1 Like