I have two devices through which i access the internet on my Ubuntu 21.10 desktop:a portable broadband device (always active/on) and my android phone's hotspot (active occasionally to save battery). Everytime i want to connect to my phone's hotspot i turn on my phone's hotspot, open ubuntu's settings, go to WiFi and then wait a few seconds for the hotspot to get discovered by the Wifi adapter and then select it and get on with my work. All of this is natural and there's no abnormal delay as such in this process but since i switch between my phone and the broadband device in the settings several times in a day it all adds up quickly and becomes really annoying and breaks my workflow. I use keyboard-shortcuts to open the settings but i still have to deal with the few seconds of wait when the hotspot is yet to be discovered by the wifi-adapter.
Aim - I want to switch to my phone's hotspot (with a terminal command) as soon as it is discovered by my desktop/wifi-adapter so that i can assign a keyboard shortcut for it in the end to make my life easier. How do i do that?