diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index a988cb9..367e8b2 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -99,6 +99,7 @@ key_bindings: - { key: Key0, mods: Control, action: ResetFontSize } - { key: Equals, mods: Control, action: IncreaseFontSize } - { key: Subtract, mods: Control, action: DecreaseFontSize } + - { key: Backslash, mods: Command, command: "/home/adam/.config/alacritty/swapColors.sh" } - { key: Home, chars: "\x1bOH", mode: AppCursor } - { key: Home, chars: "\x1b[H", mode: ~AppCursor } - { key: End, chars: "\x1bOF", mode: AppCursor } diff --git a/.config/alacritty/swapColors.sh b/.config/alacritty/swapColors.sh new file mode 100755 index 0000000..cc192a3 --- /dev/null +++ b/.config/alacritty/swapColors.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +file="$(dirname $0)/alacritty.yml" + +prefix=' foreground: ' +amber="'0xb98000'" +green="'0x008000'" +color=$amber + +if [ -n "$1" ] +then + [ "$1" == "green" ] && color=$green +else + current=$(grep -oP '^'"$prefix"'\K.*$' "$file") + echo $current + [ "$current" == "$amber" ] && color=$green +fi + +sed -i 's/^'"${prefix}"'.*/'"${prefix}${color}"'/' "$file"