-
Notifications
You must be signed in to change notification settings - Fork 0
/
ttime.py
executable file
·40 lines (23 loc) · 875 Bytes
/
ttime.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
#!/usr/bin/python3.8
from datetime import datetime
from settings import THEMES, VSCODE_CONFIG_FILE, TIME_HOUR_LIGHT_THEME
from json import dump, load
from os import system
def get_theme():
hour = datetime.now().hour
if hour >= TIME_HOUR_LIGHT_THEME['START'] and hour < TIME_HOUR_LIGHT_THEME['END']:
return THEMES['LIGHT']
return THEMES['DARK']
def set_vscode_theme():
data = None
with open(VSCODE_CONFIG_FILE) as config_file:
data = load(config_file)
current = data['workbench.colorTheme']
data['workbench.colorTheme'] = get_theme()['VSCODE']
with open(VSCODE_CONFIG_FILE, "w") as config_file:
dump(data, config_file)
def set_desktop_theme():
system(
'gsettings set org.gnome.desktop.interface gtk-theme "{0}"'.format(get_theme()['DESKTOP']))
set_desktop_theme()
set_vscode_theme()