36 lines
787 B
Python
36 lines
787 B
Python
# Antonio Sarosi
|
|
# https://youtube.com/c/antoniosarosi
|
|
# https://github.com/antoniosarosi/dotfiles
|
|
|
|
# Theming for Qtile
|
|
|
|
from os import path
|
|
import subprocess
|
|
import json
|
|
|
|
from .path import qtile_path
|
|
|
|
|
|
def load_theme():
|
|
theme = "dracula"
|
|
|
|
config = path.join(qtile_path, "config.json")
|
|
if path.isfile(config):
|
|
with open(config) as f:
|
|
theme = json.load(f)["theme"]
|
|
else:
|
|
with open(config, "w") as f:
|
|
f.write(f'{{"theme": "{theme}"}}\n')
|
|
|
|
|
|
theme_file = path.join(qtile_path, "themes", f'{theme}.json')
|
|
if not path.isfile(theme_file):
|
|
raise Exception(f'"{theme_file}" does not exist')
|
|
|
|
with open(path.join(theme_file)) as f:
|
|
return json.load(f)
|
|
|
|
|
|
if __name__ == "settings.theme":
|
|
colors = load_theme()
|