-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #45
- Loading branch information
1 parent
615bbdb
commit 0036da6
Showing
5 changed files
with
100 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# 3rd party libraries we've symlinked | ||
is | ||
yadm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
usage() { | ||
cat << HEREDOC | ||
blue | ||
Usage: | ||
blue enable | ||
blue disable | ||
blue scan [<duration>] | ||
blue devices | ||
blue paired | ||
blue connect [<device>] | ||
blue disconnect | ||
blue help | ||
HEREDOC | ||
|
||
} | ||
|
||
blue_enable() { | ||
bluetoothctl -- power on >/dev/null | ||
|
||
echo "bluetooth enabled." | ||
} | ||
|
||
blue_disable() { | ||
bluetoothctl -- power off >/dev/null | ||
|
||
echo "bluetooth disabled." | ||
} | ||
|
||
blue_scan() { | ||
duration="${1:-10}" | ||
echo "scanning..." | ||
(bluetoothctl -- scan on >/dev/null 2>&1) & | ||
sleep "$duration" | ||
kill %1 >/dev/null 2>&1 | ||
sleep 1 | ||
blue_devices | ||
} | ||
|
||
blue_devices() { | ||
echo "MAC address Name" | ||
echo "-----------------------------------" | ||
bluetoothctl -- devices | cut -d\ -s -f2- | ||
} | ||
|
||
blue_paired() { | ||
echo "MAC address Name" | ||
echo "-----------------------------------" | ||
bluetoothctl -- paired-devices | ||
} | ||
|
||
# TODO: handle case where no devices are listed | ||
blue_connect() { | ||
device="${1-"$(blue_devices | fzf --header-lines=2)"}" | ||
device_mac="$(echo "$device" | cut -d\ -f1)" | ||
|
||
bluetoothctl --agent -- connect "$device_mac" >/dev/null | ||
|
||
echo "successfully connected." | ||
} | ||
|
||
# TODO: handle case where no devices are listed | ||
blue_disconnect() { | ||
device="${1-"$(blue_devices | fzf --header-lines=2)"}" | ||
device_mac="$(echo "$device" | cut -d\ -f1)" | ||
|
||
bluetoothctl -- disconnect "$device_mac" >/dev/null | ||
|
||
echo "successfully disconnected." | ||
} | ||
|
||
blue() { | ||
cmd="$1" | ||
|
||
case "$cmd" in | ||
enable|disable|scan|devices|paired|connect|disconnect) shift; "blue_$cmd" "$@" ;; | ||
*) usage ;; | ||
esac | ||
} | ||
|
||
blue "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
#!/usr/bin/env bash | ||
#!/bin/sh | ||
|
||
set -euo pipefail | ||
set -eu | ||
|
||
username="$(id -u -n)" | ||
|
||
sudo usermod -aG docker "$username" | ||
# bluetooth | ||
sudo usermod -aG lg "$username" | ||
|
||
# virtualization | ||
sudo usermod -aG libvirt "$username" | ||
|
||
# docker | ||
sudo usermod -aG docker "$username" |