Skip to content

Instantly share code, notes, and snippets.

@n0tty
Last active October 12, 2020 18:48
Show Gist options
  • Save n0tty/7bf1bb7351b0a011de76678fad8090a9 to your computer and use it in GitHub Desktop.
Save n0tty/7bf1bb7351b0a011de76678fad8090a9 to your computer and use it in GitHub Desktop.
Bash script for connecting MXErgo on Arch linux. Small script meant for helping setup my arch linux installations.
#!/bin/bash
bluetooth_mac="MAC Address of your bluetooth mouse. Mine is a MX Ergo"
if [ ! -f /usr/bin/bluetoothctl ]; then
sudo pacman -S bluez-utils bluez
fi
systemctl is-active --quiet bluetooth || sudo systemctl start bluetooth
#Uncomment if you want to turn on bluetooth everytime your system turns on
#sudo systemctl enable bluetooth
if [ ! -f /usr/bin/bluetoothctl ]; then
sudo pacman -S bluez-utils bluez
fi
systemctl is-active --quiet bluetooth || sudo systemctl start bluetooth
#Uncomment if you want to turn on bluetooth everytime your system turns on
#sudo systemctl enable bluetooth
(echo -e "power on\n";echo -e "agent on\n";echo -e "default-agent\n";echo -e "scan on\n";sleep 5;echo -e "pair "$bluetooth_mac"\n";sleep 1;echo -e "connect "$bluetooth_mac"\n";sleep 1;echo -e "connect "$bluetooth_mac"\n";sleep 1;echo -e "trust "$bluetooth_mac"\n";sleep 1;echo -e "exit\n") | bluetoothctl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment