I run Ubuntu 18.04 on my HP, and before dual booting, when I only had Windows, I would always press the F12 key to turn the Wifi on and off easily. Now that is the only key that doesn't work on Ubuntu.
I've already tried bash scripts and keyboard settings, to no avail. At most, I managed to get messages to show up, but the wifi stayed the same. (also, the settings won't let me set F12 alone, so I set Ctrl+F12; though right now that's the least of my concerns)
Until now, I have this:
#!/bin/sh
if [ $(nmcli nm wifi | awk '/led/ {print}') = 'enabled' ] ; then
nmcli nm wifi off
# notify-send -i network-wireless-none "Wireless" "Wireless disabled"
echo 'wifi off'
else
nmcli nm wifi on
notify-send -i network-wireless-none "Wireless" "Wireless enabled"
echo 'wifi on'
fi
What could be wrong?