switch between global dark and light themes (super + F6)

This commit is contained in:
2020-07-20 09:48:41 +02:00
parent d81399a25e
commit f3d07932e4
6 changed files with 98 additions and 19 deletions

View File

@@ -1,13 +1,17 @@
#!/usr/bin/python3
import os
import sys
action = 'switch'
if len(sys.argv) > 1:
action = sys.argv[1]
path = os.path.join(os.getenv('HOME'), '.config/alacritty/alacritty.yml')
with open(path, 'r+') as f:
cfg = f.read()
if "colors: *dark" in cfg:
if "colors: *dark" in cfg and action in ['switch', 'light']:
cfg = cfg.replace("colors: *dark", "colors: *light")
else:
elif "colors: *light" in cfg and action in ['switch', 'dark']:
cfg = cfg.replace("colors: *light", "colors: *dark")
f.seek(0)
f.write(cfg)