forked from fairhopeweb/xero-sweet-git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libadwaita-tc.py
executable file
·52 lines (48 loc) · 2.34 KB
/
libadwaita-tc.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
#!/bin/python3
############################################
#
# Libadwaita Theme Changer
# created by OdzioM
#
############################################
import sys
import os
import subprocess as sp
if __name__ == "__main__":
try:
home_dir = os.getenv('HOME')
config_dir = "/.config"
themes_dir = "/.themes"
if "--reset" in sys.argv:
print(f'\n***\nResetting theme to default!\n***\n')
sp.run(["rm", f'{home_dir}{config_dir}/gtk-4.0/gtk.css'])
sp.run(["rm", f'{home_dir}{config_dir}/gtk-4.0/gtk-dark.css'])
sp.run(["rm", f'{home_dir}{config_dir}/gtk-4.0/assets'])
sp.run(["rm", f'{home_dir}{config_dir}/assets'])
else:
all_themes = str(sp.run(["ls", f'{home_dir}{themes_dir}/'], stdout=sp.PIPE).stdout.decode("UTF-8")).split()
print("Select theme: ")
for i, theme in enumerate(all_themes):
print(f'{i+1}. {theme}')
print("e. Exit")
chk = input("Your choice: ")
match chk:
case "e":
print("Bye bye!")
case _:
chk_value = int(chk)-1
chk_theme = all_themes[chk_value]
print(f'\n***\nChoosed {chk_theme}\n***\n')
print("Removing previous theme...")
sp.run(["rm", f'{home_dir}{config_dir}/gtk-4.0/gtk.css'])
sp.run(["rm", f'{home_dir}{config_dir}/gtk-4.0/gtk-dark.css'])
sp.run(["rm", f'{home_dir}{config_dir}/gtk-4.0/assets'])
sp.run(["rm", f'{home_dir}{config_dir}/assets'])
print("Installing new theme...")
sp.run(["ln", "-s", f'{home_dir}{themes_dir}/{chk_theme}/gtk-4.0/gtk.css', f'{home_dir}{config_dir}/gtk-4.0/gtk.css'])
sp.run(["ln", "-s", f'{home_dir}{themes_dir}/{chk_theme}/gtk-4.0/gtk-dark.css', f'{home_dir}{config_dir}/gtk-4.0/gtk-dark.css'])
sp.run(["ln", "-s", f'{home_dir}{themes_dir}/{chk_theme}/gtk-4.0/assets', f'{home_dir}{config_dir}/gtk-4.0/assets'])
sp.run(["ln", "-s", f'{home_dir}{themes_dir}/{chk_theme}/assets', f'{home_dir}{config_dir}/assets'])
print("Done.")
except ValueError as e:
print("Incorrect value! Please try again!")