arch linux + I3wm, script not working
I am a happy user of Arch Linux and i3-wm, but I have one problem: all binds work except for systemctl start/stop bluetooth.service.
The point was to turn Bluetooth on and off, connect headphones when turning it on. The script itself works if you run it in the terminal.
I set chmod +x for this script.
An exception is set in sudoers:
test_user ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop bluetooth.service
test_user ALL=(ALL) NOPASSWD: /usr/bin/systemctl start bluetooth.service
test_user ALL=(ALL) NOPASSWD: /usr/bin/systemctl is-active bluetooth.service
bash script:
#!/bin/bash
DEVICE="34:11:01:B3:BC:47"
if sudo systemctl is-active bluetooth.service; then
sudo systemctl stop bluetooth.service
else
sudo systemctl start bluetooth.service
sleep 1
echo -e "agent on\ndefault-agent\nconnect $DEVICE\nquit" | bluetoothctl
sleep 2
fi
I3 config
bindsym $mod+b exec bash ~/my_scripts/bluetooth_toggle.sh
#bindsym $mod+b exec bash ~/my_scripts/bluetooth_toggle.sh - not working too
#bindsym $mod+b exec bash ~/my_scripts/bluetooth_toggle.sh - not working too
But when I set Firefox to open in the script for testing, it opened, so the problem is probably in the script itself.
Also, after several launches, faillock kicked in, meaning a password was required. I don't know what's wrong.
Posted Oct 2, 2025, 1:52 PM UTC