forked from cheesecakeufo/komorebi
-
Notifications
You must be signed in to change notification settings - Fork 19
/
komorebi-wallpaper-creator.py
executable file
·75 lines (55 loc) · 1.96 KB
/
komorebi-wallpaper-creator.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python3
import argparse
import gi
import logging
import sys
import os
gi.require_versions({
'Clutter': '1.0',
'Gtk': '3.0'
})
from gi.repository import Gtk, Gio
from komorebi.wallpaper_creator.window import WallpaperWindow
import komorebi
def main_parser():
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--version',
action='version',
help='show current version',
version=f'Version: {komorebi.__version__}\nMaintained by: Komorebi Team')
parser.add_argument('-l', '--log',
type=str,
choices=['NORMAL', 'INFO', 'DEBUG'],
default='NORMAL',
help="set logging level for komorebi")
return parser
def main():
print(f'Welcome to {komorebi.__package_name__} Wallpaper Creator')
parser = main_parser()
args = parser.parse_args()
log_level = logging.WARNING
log_format = ''
if args.log:
if args.log == 'INFO':
log_level = logging.INFO
log_format = '[%(levelname)s]: %(message)s'
elif args.log == 'DEBUG':
log_level = logging.DEBUG
log_format = '[%(levelname)s] (%(asctime)s): %(message)s'
logging.basicConfig(format=log_format, level=log_level, datefmt='%H:%M:%S')
# Load resources
resource_path = os.path.join(komorebi.__package_datadir__, 'komorebi.gresource')
resource = Gio.Resource.load(resource_path)
Gio.resources_register(resource)
Gtk.init(sys.argv)
logging.debug('Gtk initialized')
window = WallpaperWindow()
main_settings = Gtk.Settings.get_default()
main_settings.props.gtk_application_prefer_dark_theme = True
main_settings.props.gtk_xft_antialias = 1
main_settings.props.gtk_xft_rgba = "none"
main_settings.props.gtk_xft_hintstyle = "slight"
window.show_all()
Gtk.main()
if __name__ == '__main__':
main()