Problem is that it calls the bluetooth service which triggers a window for the password.
The idea is to automate a connection to my keyboard which is on bluetooth, which makes it difficult to enter a password or to do anything on startup.
blueberry #the only visual tool that works for me, useful for connecting to my headset eventually later
sleep 5
cpt=0
while ((cpt<2)) #restart the bluetooth service
do
systemctl restart bluetooth #asks for password!
sleep 1
bluetoothctl connect 2B:24:13:DB:7C:99 #my keyboard
sleep 1
((cpt+=1))
done
systemctl discoverable-timeout 3 #let’s try that also if connection has not been made yet
exit 0
Before writing this script, I tested my bluetooth from the console many times and I could figure out that restarting the service could help.
Actually it’s not difficult to understand and the links provided make it fun, as you learn from ‘live’ stories.
The first test I made out of it is modifying the bluetooth service file: I removed the # sign before Restart=on-failure. (anyway systemctl status bluetooth indicates it runs on startup, it has never failed).
I still need to restart the service manually. Even my attempts to restart from my script generally fail to allow a successful bluetoothctl connect 2B:24:13:DB:7C:99
I need to elaborate a sequence that works.
For the time being, I always need my other keyboard not far away…
EDIT: I’ve finetuned the script but the resuslts are still very erratic. Bluetooth is a mess and I am not sure writing a systemd service will help in this case. Thanks anyway.
In enable-bt.sh I don’t attempt to connect to my keyboard any more. Instead I test the connection to my headset, so that I can check bluetooth. It works fine for my headset and I did not test for anything else, but for some reason I need to restart bluetooth for my keyboard.
If you have comments on my systemd script, bear in mind that I am still learning.
NB: now I am still looking for a graphic tool similar to blueberry or blueman, the one provided by Manjaro does not display anything!