The 'Airplane Mode' key on my laptop is not working in ubuntu since I have dual booted my laptop on windows and Ubuntu. Wifi hardware is Realtek RTL8723BE. Please help.
2 Answers
I also have had this problem with my HP laptop and Ubuntu 18.04. If you only need to only toggle wifi (but not bluetooth) on or off, you can use the following workaround.
Create a bash script with the following code and save it somewhere in your computer. I save mine as ~/.local/share/scripts/wifi-toggle.sh
. If you need to create a folder, you can do it using mkdir /path/to/folder
or using the file manager.
#!/bin/bash
wifi_status=`rfkill list wifi | grep "Soft" | cut -d " " -f 3`
icon_dir=/usr/share/icons/Adwaita/scalable/status
if [ $wifi_status == 'no' ]; then
nmcli radio all off
notify-send -i $icon_dir/network-wireless-offline-symbolic.svg --hint int:transient:1 "Wi-Fi turned off"
else
nmcli radio all on
notify-send -i $icon_dir/network-wireless-signal-excellent-symbolic.svg --hint int:transient:1 "Wi-Fi turned on"
fi
Give execution permissions to your script (I am assuming that the location you saved it is the same as mine; if not, use your location):
chmod +x ~/.local/share/scripts/wifi-toggle.sh
Then, open Gnome settings, go to Keyboard and add a new shortcut (I use Ctrl+F12) using the full path of your script as a command, i.e. /home/your_name/.local/share/scripts/wifi-toggle.sh
, where your_name
is your user's name.
Edit: This script can be used to turn full airplane mode on or off.
#!/bin/bash
wifi_status=`rfkill list wifi | grep "Soft" | cut -d " " -f 3`
bluetooth_status=`rfkill list bluetooth | grep "Soft" | cut -d " " -f 3`
icon_dir=/usr/share/icons/Adwaita/scalable/status
if [ $wifi_status == 'no' ] || [ $bluetooth_status == 'no' ]; then
rfkill block all
notify-send -i $icon_dir/airplane-mode-symbolic.svg --hint int:transient:1 "Airplane mode turned on"
else
rfkill unblock all
notify-send -i $icon_dir/network-wireless-signal-excellent-symbolic.svg --hint int:transient:1 "Airplane mode turned off"
fi
However, for me this would need to be run as sudo
(I am now using Xubuntu 18.04, so I am not sure if this is the case for Ubuntu too). Save it as ~/.local/share/scripts/airplane-toggle.sh
and change its permissions with chmod +x
as before. Try running it from terminal with and without sudo
. If it runs without sudo
, then map it to a shortcut as before. If not, you can only run it with sudo
through the terminal.

- 14,585
I had to disable the keyboard actions setting in BIOS to regain fn + F keys normal function. I'm using HP Pavillion DM4 Laptop.

- 1
sudo
. All I can see is a notification mentioning 'Airplane mode turned on/off', but actually my Wi-Fi hardware is still in disabled state, – soham_dhole Jul 30 '19 at 13:00rfkill block all
and thenrfkill unblock all
(with and withoutsudo
)? Also, it takes a bit more time fo the wifi to get turned on, so wait a few seconds to see if it will turn on. – BeastOfCaerbannog Jul 30 '19 at 13:05rfkill
are not working. For detailed explainantion of my problem kindly see this [link] (https://askubuntu.com/questions/1162067/wifi-hardware-gets-disabled-when-laptop-lid-is-closed-or-pc-is-locked-for-more-t). – soham_dhole Jul 30 '19 at 13:05