Mount/unmount SMB shares when connecting/disconnecting from Wi-Fi networks

Trying to get a smb share to automatically mount/unmount when I connect/disconnect from a Wi-Fi network on a Plasma desktop.

I have found Smb4k that when started it will remount a share and if the Wi-Fi network is disconnected the share will be unmounted.

But this does not help when it is already running and I change Wi-Fi networks. I would like it to automatically switch profiles and mount a specific share for the Wi-Fi network. For example mount one share when at home and another when in the office.

Any ideas much appreciated!

https://wiki.archlinux.org/title/NetworkManager

Specifically “Network services with NetworkManager dispatcher”

and

5.21.6 Mounting of SMB shares