You are not logged in.

#1 2018-09-08 11:27:20

samrob85
Member
Registered: 2017-07-23
Posts: 31

[Solved] Toggling bluetooth using keyboard shortcut

I am running KDE and it has no built-in functionality to toggle the bluetooth state. I know that I can use rfkill block bluetooth and rfkill unblock bluetooth, but I am looking to have a single keyboard shortcut to toggle bluetooth, rather than one to turn it on, and one to turn it off. So is there any command that would be like rfkill toggle bluetooth (I know this does not exist), that I could use to toggle the bluetooth state?

Last edited by samrob85 (2018-09-10 11:04:37)

Offline

#2 2018-09-08 12:58:40

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: [Solved] Toggling bluetooth using keyboard shortcut

You can read the current status with rfkill and act on it

if rfkill -ro Soft list bluetooth | grep -q "^blocked"
then
  some action
else
  another action
fi

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#3 2018-09-10 11:04:58

samrob85
Member
Registered: 2017-07-23
Posts: 31

Re: [Solved] Toggling bluetooth using keyboard shortcut

progandy wrote:

You can read the current status with rfkill and act on it

if rfkill -ro Soft list bluetooth | grep -q "^blocked"
then
  some action
else
  another action
fi

That's perfect thank you

Offline

Board footer

Powered by FluxBB