This forum has been archived. All content is frozen. Please use KDE Discuss instead.

keyboard shortcut to enable or activate bluetooth

Tags: None
(comma "," separated)
talby
Registered Member
Posts
3
Karma
0
OS
System Settings - Network - Bluetooth
"Bluetooth is disabled" after each reboot and I can activate it here by a click on the "Enable" button.
Please, how is it possible to define a keyboard shortcut for this general activation of bluetooth, so that afterwards I could see other bluetooth devices and connect to the one which I am interested in? I did not find where or how to define the shortcut for this.

Operating System: Debian GNU/Linux
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.62.
Qt Version: 5.12.5
Kernel Version: 5.5.0-2-amd64
User avatar
Mamarok
Manager
Posts
6071
Karma
16
OS
There isn't, as this is a hardware feature. Enabling Network services on startup is something the distributions can provide, this is a feature you should request there, but it is unlikely to be provided as it would contradict basic security settings.

Of course you can always enable these services with a script that runs on startup.


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
talby
Registered Member
Posts
3
Karma
0
OS
Mamarok wrote:Of course you can always enable these services with a script that runs on startup.

Thanks for the fast response! But you misunderstood what I am searching for. As you said, I could always enable these services with a script that runs on startup. Yes. The question is not how to enable the service in the OS, the question is how to configure a shortcut to the function of a button which KDE Plasma provides.

I can enable this particular service by a mouse click, as KDE Plasma provides a button for this. You can find it here: System Settings - Network - Bluetooth. There, emphasized by alarming color it is written "Bluetooth is disabled" and next to it is nicely provided an "Enable" button which perfectly works. I would like to have this button to become triggered by a keyboard shortcut and would like to know where and how to configure this shortcut. I could imaging, although not finding it readily offered in the System Settings - Workspace - Shortcuts - Global Shortcuts section, that it still might be possible to maybe (how?) configure this in the Custom Shortcuts section or maybe by directly editing a configuration file (which line has to be added to which file?). Well, this is what I am searching for.
User avatar
Mamarok
Manager
Posts
6071
Karma
16
OS
Sadly I am not a dev, I will have to ask around, sorry.


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
User avatar
darhma
Registered Member
Posts
4
Karma
0
OS
You can install rfkill but it needs root privileges to work, if you have sudo enabled you can trigger a command like this to enable bluetooth:
Code: Select all
konsole -e sudo rfkill unblock bluetooth

this command open a konsole terminal just to input the sudo password and then close the terminal and activate the bluetooth
if you want to disable bluetooth you have to replace "unblock" with "block"
User avatar
darhma
Registered Member
Posts
4
Karma
0
OS
another way to enable bluetooth is to use connman that doesn't require root privileges.
install connman:
Code: Select all
sudo apt install connman

enable the connman.service
then use
Code: Select all
connmanctl enable bluetooth
to enable bluetooth
User avatar
Mamarok
Manager
Posts
6071
Karma
16
OS
So in other words: unless you have a bluetooth key on the keyboard, this can't be done, as it is on the kernel module level.


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
User avatar
darhma
Registered Member
Posts
4
Karma
0
OS
You can add a custom keyboard shortcut to execute the command. I've just added the shortcut super+x with the connman command posted above and it seems to work fine
talby
Registered Member
Posts
3
Karma
0
OS
I understand, the GUI button reassembles what at the command line can be achieved by this command:
rfkill unblock bluetooth
The shortcut can then be defined here:
System Settings - Workspace - Shortcuts - Custom Shortcut
As the action, the above mentioned CLI command has to be set and the shortcut can be defined as usual, both here:
Edit - New - Global Shortcut - Command/URL

Thanks a lot @Mamarok and @darhma, this indeed works (no sudo needed), and thanks also to Luca and Helge who commented on it in the debian-kde email list here:
https://lists.debian.org/debian-kde/202 ... 00014.html
https://lists.debian.org/debian-kde/202 ... 00011.html


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar