alacritty: add config with color switching, use as terminal in i3

This commit is contained in:
Łukasz Pankowski 2020-05-06 22:58:38 +02:00
parent ebd7b86e4c
commit aa1690a445
3 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,19 @@
# See: /usr/share/doc/alacritty/example/alacritty.yml
env:
TERM: xterm-256color
colors:
primary:
background: '#424242'
foreground: '#eeeeee'
font:
size: 13.5
normal:
family: Fantasque Sans Mono
key_bindings:
- key: F6
mods: Control|Shift
command: { program: "/bin/sh", args: ["-c", "~/.config/alacritty/switch_bg.py"] }

15
.config/alacritty/switch_bg.py Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/python3
import os
path = os.path.join(os.getenv('HOME'), '.config/alacritty/alacritty.yml')
with open(path, 'r+') as f:
cfg = f.read()
if " background: '#424242'" in cfg:
cfg = cfg.replace(" background: '#424242'", " background: '#fafafa'")
cfg = cfg.replace(" foreground: '#eeeeee'", " foreground: '#424242'")
else:
cfg = cfg.replace(" background: '#fafafa'", " background: '#424242'")
cfg = cfg.replace(" foreground: '#424242'", " foreground: '#eeeeee'")
f.seek(0)
f.write(cfg)

View File

@ -22,7 +22,7 @@ bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 3
floating_modifier $mod floating_modifier $mod
# start a terminal # start a terminal
bindsym $mod+Shift+Return exec "emacsclient -n -c --eval '(vterm)'" bindsym $mod+Shift+Return exec alacritty
# start new Emacs frame # start new Emacs frame
bindsym $mod+e exec "emacsclient -n -c" bindsym $mod+e exec "emacsclient -n -c"