alacritty: add binding to swap foreground color between green and orange

This commit is contained in:
Adam Goldsmith 2018-11-13 12:56:58 -05:00
parent 83be4a8e85
commit 5fc4968a93
2 changed files with 20 additions and 0 deletions

View File

@ -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 }

19
.config/alacritty/swapColors.sh Executable file
View File

@ -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"