Likely this could be adapted to use other hotkeys.
rfkill needs to be installed.
To find acpi events, run acpi_listen in Konsole, then press a hotkey such as ThinkVantage or hotkey combo such as Fn+F9. Some potential hotkey(s) will not show acpi events as they are already used by the system.
For using Fn+F9 I created the file /etc/acpi/events/bluetoothconf as root.
- Code: Select all
event=ibm/hotkey HKEY 00000080 00001009
action=/etc/acpi/actions/bluetooth.sh
I created the file /etc/acpi/actions/bluetooth.sh as root and made it executable.
- Code: Select all
#!/bin/sh
BT_RFKILL=$(rfkill list | grep tpacpi_bluetooth_sw | sed 's/\([0-9]\+\):.*/\1/')
BT_STATE=$(/usr/bin/rfkill list $BT_RFKILL | grep "Soft blocked: yes")
if [ "x" == "x$BT_STATE" ]; then
/usr/bin/rfkill block $BT_RFKILL
else
/usr/bin/rfkill unblock $BT_RFKILL
fi
exit 0
Lastly I ran the following command in Konsole as root:
- Code: Select all
etc/init.d/acpid restart
Now I use Fn+F9 to toggle the Bluetooth Radio off and on.