From e9dc4c1090abb01317847c417b75d3960f3da34d Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Fri, 3 Feb 2023 14:39:07 -0600 Subject: only install platform-appropriate configs based on uname --- bin/all/color_test | 32 ++++++++++++++++++++++++++++++++ bin/backup | 27 --------------------------- bin/color_test | 32 -------------------------------- bin/dmenu-wl | 5 ----- bin/dnf-needs-restarting | 26 -------------------------- bin/linux/backup | 27 +++++++++++++++++++++++++++ bin/linux/dmenu-wl | 5 +++++ bin/linux/dnf-needs-restarting | 26 ++++++++++++++++++++++++++ bin/linux/setbright | 23 +++++++++++++++++++++++ bin/linux/setvol | 23 +++++++++++++++++++++++ bin/setbright | 23 ----------------------- bin/setvol | 23 ----------------------- 12 files changed, 136 insertions(+), 136 deletions(-) create mode 100755 bin/all/color_test delete mode 100755 bin/backup delete mode 100755 bin/color_test delete mode 100755 bin/dmenu-wl delete mode 100755 bin/dnf-needs-restarting create mode 100755 bin/linux/backup create mode 100755 bin/linux/dmenu-wl create mode 100755 bin/linux/dnf-needs-restarting create mode 100755 bin/linux/setbright create mode 100755 bin/linux/setvol delete mode 100755 bin/setbright delete mode 100755 bin/setvol (limited to 'bin') diff --git a/bin/all/color_test b/bin/all/color_test new file mode 100755 index 0000000..6d6b6aa --- /dev/null +++ b/bin/all/color_test @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Based on Daniel Crisman's ANSI color chart script from +# The Bash Prompt HOWTO: 6.1. Colours +# http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html +# +# This function echoes a bunch of color codes to the +# terminal to demonstrate what's available. Each +# line is the color code of one forground color, +# out of 17 (default + 16 escapes), followed by a +# test use of that color on all nine background +# colors (default + 8 escapes). + +set -euo pipefail + +T='gYw' # The test text + +echo -e "\n def 40m 41m 42m 43m 44m 45m 46m 47m"; + +for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \ + '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \ + ' 36m' '1;36m' ' 37m' '1;37m'; + + do FG=${FGs// /} + echo -en " $FGs \033[$FG $T " + + for BG in 40m 41m 42m 43m 44m 45m 46m 47m; + do echo -en "\033[$FG\033[$BG $T \033[0m"; + done + echo; +done +echo diff --git a/bin/backup b/bin/backup deleted file mode 100755 index 75aded9..0000000 --- a/bin/backup +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -set -o allexport -# shellcheck source=../local/duplicity-config -source ~/.config/duplicity/config -set +o allexport - -source_directory=~ -excludes=~/.config/duplicity/excludes -target_url=b2://"$B2_KEY_ID"@"$B2_BUCKET" - -# take a new full backup every month, incremental otherwise -duplicity --full-if-older-than 1M --exclude-filelist "$excludes" "$source_directory" "$target_url" - -# keep 12 months of full backups -duplicity remove-all-but-n-full 12 --force "$target_url" - -# keep 3 months of incremental backups -duplicity remove-all-inc-of-but-n-full 3 --force "$target_url" - -# cleanup -duplicity cleanup --force "$target_url" - -# show collection status -duplicity collection-status "$target_url" diff --git a/bin/color_test b/bin/color_test deleted file mode 100755 index 6d6b6aa..0000000 --- a/bin/color_test +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# Based on Daniel Crisman's ANSI color chart script from -# The Bash Prompt HOWTO: 6.1. Colours -# http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html -# -# This function echoes a bunch of color codes to the -# terminal to demonstrate what's available. Each -# line is the color code of one forground color, -# out of 17 (default + 16 escapes), followed by a -# test use of that color on all nine background -# colors (default + 8 escapes). - -set -euo pipefail - -T='gYw' # The test text - -echo -e "\n def 40m 41m 42m 43m 44m 45m 46m 47m"; - -for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \ - '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \ - ' 36m' '1;36m' ' 37m' '1;37m'; - - do FG=${FGs// /} - echo -en " $FGs \033[$FG $T " - - for BG in 40m 41m 42m 43m 44m 45m 46m 47m; - do echo -en "\033[$FG\033[$BG $T \033[0m"; - done - echo; -done -echo diff --git a/bin/dmenu-wl b/bin/dmenu-wl deleted file mode 100755 index 7ac2273..0000000 --- a/bin/dmenu-wl +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -wofi -d "$@" diff --git a/bin/dnf-needs-restarting b/bin/dnf-needs-restarting deleted file mode 100755 index 60f7f7c..0000000 --- a/bin/dnf-needs-restarting +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -eo pipefail - -if command -v dnf > /dev/null; then - DNFCMD="dnf" -fi -if command -v jq > /dev/null; then - JQCMD="jq" -fi -if [ -z "$DNFCMD" ] || [ -z "$JQCMD" ]; then - echo "{\"tooltip\": \"requires 'jq' and 'dnf'\", \"text\": \"\"}" - exit 1 -fi - -set -u - -if ! output="$($DNFCMD needs-restarting -r)"; then - icon="勒" -else - icon="" -fi - -# this is a literal expression for `jq` -# shellcheck disable=SC2016 -$JQCMD --unbuffered -n -c '{tooltip: $ARGS.positional[0], text: $ARGS.positional[1]}' --args "$output" "$icon" diff --git a/bin/linux/backup b/bin/linux/backup new file mode 100755 index 0000000..75aded9 --- /dev/null +++ b/bin/linux/backup @@ -0,0 +1,27 @@ +#!/bin/bash + +set -euo pipefail + +set -o allexport +# shellcheck source=../local/duplicity-config +source ~/.config/duplicity/config +set +o allexport + +source_directory=~ +excludes=~/.config/duplicity/excludes +target_url=b2://"$B2_KEY_ID"@"$B2_BUCKET" + +# take a new full backup every month, incremental otherwise +duplicity --full-if-older-than 1M --exclude-filelist "$excludes" "$source_directory" "$target_url" + +# keep 12 months of full backups +duplicity remove-all-but-n-full 12 --force "$target_url" + +# keep 3 months of incremental backups +duplicity remove-all-inc-of-but-n-full 3 --force "$target_url" + +# cleanup +duplicity cleanup --force "$target_url" + +# show collection status +duplicity collection-status "$target_url" diff --git a/bin/linux/dmenu-wl b/bin/linux/dmenu-wl new file mode 100755 index 0000000..7ac2273 --- /dev/null +++ b/bin/linux/dmenu-wl @@ -0,0 +1,5 @@ +#!/bin/bash + +set -euo pipefail + +wofi -d "$@" diff --git a/bin/linux/dnf-needs-restarting b/bin/linux/dnf-needs-restarting new file mode 100755 index 0000000..60f7f7c --- /dev/null +++ b/bin/linux/dnf-needs-restarting @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eo pipefail + +if command -v dnf > /dev/null; then + DNFCMD="dnf" +fi +if command -v jq > /dev/null; then + JQCMD="jq" +fi +if [ -z "$DNFCMD" ] || [ -z "$JQCMD" ]; then + echo "{\"tooltip\": \"requires 'jq' and 'dnf'\", \"text\": \"\"}" + exit 1 +fi + +set -u + +if ! output="$($DNFCMD needs-restarting -r)"; then + icon="勒" +else + icon="" +fi + +# this is a literal expression for `jq` +# shellcheck disable=SC2016 +$JQCMD --unbuffered -n -c '{tooltip: $ARGS.positional[0], text: $ARGS.positional[1]}' --args "$output" "$icon" diff --git a/bin/linux/setbright b/bin/linux/setbright new file mode 100755 index 0000000..42cd48f --- /dev/null +++ b/bin/linux/setbright @@ -0,0 +1,23 @@ +#!/bin/bash + +set -euo pipefail + +current=$(brightnessctl -m info | cut -d, -f4 | tr --delete '%') +case $1 in + up) + increment=$(( 5 - ( current % 5 ) )) + new=$(( current + increment )) + if [ $new -gt 100 ]; then + new=100 + fi + brightnessctl set $new% > /dev/null 2>&1 + echo $new;; + down) + increment=$(( ( ( current - 1 ) % 5 ) + 1 )) + new=$(( current - increment )) + if [ $new -lt 0 ]; then + new=0 + fi + brightnessctl set $new% > /dev/null 2>&1 + echo $new;; +esac diff --git a/bin/linux/setvol b/bin/linux/setvol new file mode 100755 index 0000000..bf9cbed --- /dev/null +++ b/bin/linux/setvol @@ -0,0 +1,23 @@ +#!/bin/bash + +set -euo pipefail + +current_volume=$(pactl get-sink-volume @DEFAULT_SINK@ | grep Volume | sed -e 's/.* \([0-9][0-9]*\)%.*/\1/') +case $1 in + up) + increment=$(( 5 - ( current_volume % 5 ) )) + newvol=$(( current_volume + increment )) + if [ $newvol -gt 100 ]; then + newvol=100 + fi + pactl set-sink-volume @DEFAULT_SINK@ $newvol% + echo $newvol;; + down) + increment=$(( ( ( current_volume - 1 ) % 5 ) + 1 )) + newvol=$(( current_volume - increment )) + if [ $newvol -lt 0 ]; then + newvol=0 + fi + pactl set-sink-volume @DEFAULT_SINK@ $newvol% + echo $newvol;; +esac diff --git a/bin/setbright b/bin/setbright deleted file mode 100755 index 42cd48f..0000000 --- a/bin/setbright +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -current=$(brightnessctl -m info | cut -d, -f4 | tr --delete '%') -case $1 in - up) - increment=$(( 5 - ( current % 5 ) )) - new=$(( current + increment )) - if [ $new -gt 100 ]; then - new=100 - fi - brightnessctl set $new% > /dev/null 2>&1 - echo $new;; - down) - increment=$(( ( ( current - 1 ) % 5 ) + 1 )) - new=$(( current - increment )) - if [ $new -lt 0 ]; then - new=0 - fi - brightnessctl set $new% > /dev/null 2>&1 - echo $new;; -esac diff --git a/bin/setvol b/bin/setvol deleted file mode 100755 index bf9cbed..0000000 --- a/bin/setvol +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -current_volume=$(pactl get-sink-volume @DEFAULT_SINK@ | grep Volume | sed -e 's/.* \([0-9][0-9]*\)%.*/\1/') -case $1 in - up) - increment=$(( 5 - ( current_volume % 5 ) )) - newvol=$(( current_volume + increment )) - if [ $newvol -gt 100 ]; then - newvol=100 - fi - pactl set-sink-volume @DEFAULT_SINK@ $newvol% - echo $newvol;; - down) - increment=$(( ( ( current_volume - 1 ) % 5 ) + 1 )) - newvol=$(( current_volume - increment )) - if [ $newvol -lt 0 ]; then - newvol=0 - fi - pactl set-sink-volume @DEFAULT_SINK@ $newvol% - echo $newvol;; -esac -- cgit v1.2.3