mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit 8e9fef99243ed1fe29a8dc363fa3225f2aa42001
parent 3e4292df9f613a6a78d415eb9e59ef633cbf7a05
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sun, 25 Sep 2016 20:45:03 +0200

Merge branch 'master' of a3nm.net:git/mybin

Diffstat:
bluetooth_connect | 33++++++++++++++++++++++++---------
dodo | 3+++
duuid | 5+++--
3 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/bluetooth_connect b/bluetooth_connect @@ -1,12 +1,27 @@ +#!/bin/bash + set -e set -x -HW="$1" +FILE="$HOME/config/private/bluetooth" +DEVICE="$1" +HW=$(grep "^$DEVICE\s" "$FILE" | cut -d' ' -f2) +if [[ -z "$HW" ]] +then + >&2 echo "no registered device $DEVICE in $FILE" + >&2 echo "try adding one from paired devices?" + # echo "paired-devices" | bluetoothctl 2>/dev/null | grep '^Device' + exit 2 +fi + + ID=$(rfkill list | grep -i hci0 | cut -d':' -f1) -rfkill unblock 2 -echo "power on -default-agent -pairable on -scan on -pair $HW -trust $HW -connect $HW" | bluetoothctl -a +rfkill unblock $ID +(echo "power on"; sleep 0.1; +echo "default-agent"; sleep 0.1; +echo "pairable on"; sleep 0.1; +echo "scan on"; sleep 0.1; +echo "pair $HW"; sleep 0.5; +echo "trust $HW"; sleep 0.5; +echo "connect $HW"; sleep 2; +echo quit; sleep 0.2) | bluetoothctl -a + diff --git a/dodo b/dodo @@ -9,3 +9,6 @@ xtrlock & sudo pm-suspend +layout +synclient TapButton2=2 + diff --git a/duuid b/duuid @@ -4,9 +4,10 @@ VOLUME="$1" HOST=$(hostname | cut -d'.' -f1) -FILE="$HOME/config/private/duuid/$HOST" +FOLDER="$HOME/config/private/duuid" -ID="$(grep "^$VOLUME " "$FILE" | cut -d' ' -f2)" +# hack: search first in local file, then in all files +ID="$(grep "^$VOLUME " $FOLDER/$HOST $FOLDER/* | cut -d' ' -f2 | head -1)" if [[ -z "$ID" ]] then