aboutsummaryrefslogtreecommitdiff
path: root/linux/home/.scripts/opacity-change.sh
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2025-10-01 17:21:05 +0200
committersrdusr <trevorgray@srdusr.com>2025-10-01 17:21:05 +0200
commitafe53c73bfd21a2931afccae9ea0bcfbfd4a9405 (patch)
treead83f1a6da18ed04808040ce1eff4b7d878d1ede /linux/home/.scripts/opacity-change.sh
parenta1c6c0e20541575e57660d771b8a948d558648d1 (diff)
downloaddotfiles-afe53c73bfd21a2931afccae9ea0bcfbfd4a9405.tar.gz
dotfiles-afe53c73bfd21a2931afccae9ea0bcfbfd4a9405.zip
Testing updated dir structures
Diffstat (limited to 'linux/home/.scripts/opacity-change.sh')
-rwxr-xr-xlinux/home/.scripts/opacity-change.sh34
1 files changed, 0 insertions, 34 deletions
diff --git a/linux/home/.scripts/opacity-change.sh b/linux/home/.scripts/opacity-change.sh
deleted file mode 100755
index b509936..0000000
--- a/linux/home/.scripts/opacity-change.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-set -eu
-[[ -n ${DEBUG:-} ]] && set -x
-
-#### Example alacritty.yml usage
-#key_bindings:
-# - { key: N, mods: Control|Shift, action: SpawnNewInstance }
-# - { key: O, mods: Control|Shift, command: { program: "opacity-change.sh", args: ["-"] } }
-# - { key: P, mods: Control|Shift, command: { program: "opacity-change.sh", args: ["+"] } }
-
-
-operation="${1:-}${2:-}" # Arg #1 & #2 (in case the user misinterpreted a space in the usage), Default ''
-step="${operation:1}" # Substring from char index 1
-step="${step:-1}" # Default '1'
-operation="${operation:0:1}" # Substring from char index 0 length of 1
-config_file="$HOME/.config/alacritty/alacritty.yml"
-config_field="opacity"
-tmp_file="/tmp/$(basename $config_file).$(date +%s)"
-current_value=$(sed 's/#.*//g; /\b'"$config_field"':/!d; s/.*: \?//' < "$config_file")
-
-case $operation in
-"-")
- verb="Decreasing" ;;
-"+")
- verb="Increasing" ;;
-*)
- echo "Usage: ${BASH_SOURCE[0]} (-|+)[int]"; exit 255 ;;
-esac
-
-new_value="$(awk '{n=$1+$2/10; print (n<0 ? 0 : n>1 ? 1 : n)}' <<<"$current_value $operation$step")"
-echo "$verb $config_field from $current_value to $new_value" >&2
-cp "$config_file" "$tmp_file"
-sed "s/\b$config_field:.*/$config_field: $new_value/" "$tmp_file" > "$config_file"
-