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
|
import user_interface
import manage_saves
import os
from rich import print
def get_args(args, walls_dir, theme_dir) -> tuple:
# arguments that can be passed into program
VALID_ARGS = ['-r', '-p', '--initialize', '--reconfigure']
initialize = False
reconfigure = False
theme = None
img_path = ''
if '-p' in args:
index = args.index('-p')
isFile = os.path.isfile(args[index + 1])
if isFile == True:
theme = manage_saves.load_theme(args[index + 1])
img_path = grab_image(args)
elif '-t' in args:
theme = user_interface.themeSelector(theme_dir)
img_path = theme['wallpaper']
elif '-r' in args:
img_path = user_interface.pickRandomWallpaper(walls_dir)
else:
img_path = grab_image(args)
if '--initialize' in args:
initialize = True
if '--reconfigure' in args:
reconfigure = True
return img_path, initialize, reconfigure, theme
def grab_image(args):
img_path = f"{os.getcwd()}/{args[1]}"
if not os.path.exists(img_path):
print(f'[bold red]ERROR: invalid image path {os.getcwd()}/{args[1]}')
exit(2)
else:
return img_path
def usage(args) -> None:
print(f"""Instant Rice - An automatic theming utilitiy
Usage: python3 {args[0]} [Relative Image Path] [-r, --initialize, --reconfigure, --dmenu, --nolock]
Example: rice ships.png --dmenu --nolock
Optinal Arguments:
-r Pick a random image from the wallpaper folder specified in paths.py
--initialize Check all configurations files are present and written in a way compatible with instant rice
--reconfigure launch a TUI interface to change configuration settings of DE components (i3, polybar, rofi, etc)
--dmenu generate configuration for dmenu in i3 configuration (update dmenu keyboard shortcut)
--nolock skip generating image for i3lock
It is recommended to alias Instant Rice to a convenient command in your shells config.
For bash this would look like
alias rice='/home/chandler/Documents/InstantRice/src/instant_rice.py'
visit chqn.xyz for other projects""")
|