diff options
Diffstat (limited to '.local/bin')
| -rwxr-xr-x | .local/bin/scripts/bluecontrol | 61 | ||||
| -rwxr-xr-x | .local/bin/scripts/dmenucmd | 9 | ||||
| -rwxr-xr-x | .local/bin/scripts/transadd | 2 |
3 files changed, 72 insertions, 0 deletions
diff --git a/.local/bin/scripts/bluecontrol b/.local/bin/scripts/bluecontrol new file mode 100755 index 0000000..ea36ff4 --- /dev/null +++ b/.local/bin/scripts/bluecontrol @@ -0,0 +1,61 @@ +#!/bin/sh + +fGetDevices() +{ + bluetoothctl -- devices +} + +fGetDevice() +{ + fGetDevices | dmenucmd +} + +fPower() +{ + local state=$(bluetoothctl -- show | grep -i "powered" | awk '{ print $2 }') + case $state in + yes) bluetoothctl -- power off && notify-send "Power turned off" ;; + no) bluetoothctl -- power on && notify-send "Power turned on" ;; + esac +} + +fScan() +{ + local time=3 + notify-send "Turning on scanning for $time seconds" + timeout $time bluetoothctl -- scan on + notify-send "Scanning turned off" +} + +fConnect() +{ + local device=$(fGetDevices | dmenucmd | awk '{ print $2 }') + local output=$(bluetoothctl -- connect "$device") + (echo "$output" | grep -i "successful") && notify-send "Connection successful" && return + (echo "$output" | grep -i "failed") && notify-send "Failed to connect" && return +} + +fRemove() +{ + local device=$(fGetDevices | dmenucmd | awk '{ print $2 }') + bluetoothctl -- remove "$devices" + notify-send "Removed device" +} + +fDisconnect() +{ + bluetoothctl -- disconnect + notify-send "Disconnected" +} + +command=$(echo -e "connect\nremove\ndisconnect\nscan\npower" | dmenucmd) +case $command in + connect) fConnect ;; + remove) fRemove ;; + disconnect) fDisconnect ;; + scan) fScan ;; + power) fPower ;; +esac + +# Update dwmblocks status if connected +pkill -RTMIN+9 dwmblocks diff --git a/.local/bin/scripts/dmenucmd b/.local/bin/scripts/dmenucmd new file mode 100755 index 0000000..d205e0c --- /dev/null +++ b/.local/bin/scripts/dmenucmd @@ -0,0 +1,9 @@ +#!/bin/sh +dmenumon="0" +dmenufont="monospace:size=15" +col_gray1="#222222"; +col_gray2="#444444"; +col_gray3="#bbbbbb"; +col_gray4="#eeeeee"; +col_cyan="#005577"; +dmenu -l 10 -i -m $dmenumon -fn $dmenufont -nb $col_gray1 -nf $col_gray3 -sb $col_cyan -sf $col_gray4 diff --git a/.local/bin/scripts/transadd b/.local/bin/scripts/transadd new file mode 100755 index 0000000..c269cc9 --- /dev/null +++ b/.local/bin/scripts/transadd @@ -0,0 +1,2 @@ +#!/bin/sh +transmission-remote -a "$@" && notify-send "Torrent added" |