forked from stav121/i3wm-themer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
i3wm-themer.py
56 lines (46 loc) · 1.63 KB
/
i3wm-themer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/env python3
# Author : Stavros Grigoriou
import os
import argparse
import dis
import yaml
import os.path
from pprint import pprint
import msgfunc as prnt
import fileutils as fileu
import config as conf
import backup
import install
import load_json as lj
import replace_xresources as rx
import replace_i3 as ri
import replace_polybar as rp
import replace_wallpaper as rw
import command as com
if __name__=="__main__":
parser = argparse.ArgumentParser(description='i3wm-themer by Stavros Grigoriou')
parser.add_argument('-c','--config', type=str, required=True, help='Load config file')
parser.add_argument('-b','--backup', type=str, help='Backup files')
parser.add_argument('-i','--install', type=str, help='Install i3wmthemer\'s default configuration files')
parser.add_argument('-l','--load', type=str, help='Load theme from JSON file')
args = parser.parse_args()
configuration = {}
if args.config != None :
configuration = conf.read_config( args.config)
else:
exit(0)
if args.backup != None :
backup.backup_config( args.backup, configuration)
exit(0)
if args.install != None :
install.install_defaults( args.install, configuration)
com.refresh_all( configuration['xresources'], '')
exit(0)
if args.load != None:
jfile = lj.load_json( args.load)
rx.replace_xresources( configuration, jfile)
ri.replace_i3( configuration, jfile)
rp.replace_polybar( configuration, jfile)
rw.replace_wallpaper( configuration, jfile)
com.refresh_all( configuration['xresources'], jfile['wallpaper'])
exit(0)