diff options
| author | Chandler J <cjustice2000@gmail.com> | 2024-04-13 13:44:44 -0600 |
|---|---|---|
| committer | Chandler J <cjustice2000@gmail.com> | 2024-04-13 13:44:44 -0600 |
| commit | fba95abb417e0907c6148b61acae791ae01adb28 (patch) | |
| tree | 9c2bd4356857069d7c40a947bedc346bbf101ecd | |
| parent | d1f74e783cd9af20a81e86783e0b7fe23371e208 (diff) | |
more smarter and better
| -rw-r--r-- | data/default_config.rice | 5 | ||||
| -rw-r--r-- | src/get_args.py | 17 | ||||
| -rw-r--r-- | src/theme.py | 12 | ||||
| -rw-r--r-- | src/user_interface.py | 2 |
4 files changed, 15 insertions, 21 deletions
diff --git a/data/default_config.rice b/data/default_config.rice index f277b19..83aff5f 100644 --- a/data/default_config.rice +++ b/data/default_config.rice @@ -1,4 +1,5 @@ use_dmenu = True # apply color scheme to dmenu in i3 configuration generate_i3_lock = True # convert image to png and scale to screen size for i3 lock image - -#wallpaper_directory = '/home/[username]/Pictures/papes' +wallpaper_directory = '/home/[username]/Pictures/papes' # location where wallpapers are stored +theme_directory = '/home/[username]/.config/instantrice/themes/' # location of instant rice themes +menu_button = $mod+d # keyboard shortcut associated with opening application menu diff --git a/src/get_args.py b/src/get_args.py index 9197995..5419fc4 100644 --- a/src/get_args.py +++ b/src/get_args.py @@ -17,19 +17,15 @@ def get_args(args, walls_dir, theme_dir) -> tuple: index = args.index('-p') isFile = os.path.isfile(args[index + 1]) if isFile == True: - print("reached") 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 = f"{os.getcwd()}/{args[1]}" - if not os.path.exists(img_path) and\ - args[1] not in VALID_ARGS: - print(f'[bold red]ERROR: invalid image path {os.getcwd()}/{args[1]}') - exit(2) + img_path = grab_image(args) if '--initialize' in args: initialize = True @@ -38,6 +34,15 @@ def get_args(args, walls_dir, theme_dir) -> tuple: 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 diff --git a/src/theme.py b/src/theme.py deleted file mode 100644 index 4bda7e1..0000000 --- a/src/theme.py +++ /dev/null @@ -1,12 +0,0 @@ - -class Theme: - def __init__(self, colors, comp_colors, wallpaper): - self.colors = colors - self.comp_colors = comp_colors - self.wallpaper = wallpaper - def toDict(self): - return { - "colors" : self.colors, - "comp_colors": self.comp_colors, - "wallpaper" : self.wallpaper - } diff --git a/src/user_interface.py b/src/user_interface.py index 1ac0636..d79dbb9 100644 --- a/src/user_interface.py +++ b/src/user_interface.py @@ -126,7 +126,7 @@ def themeSelector(theme_dir): comp_colors += f'[on {theme['comp_colors'][j]}] [/on {theme['comp_colors'][j]}]' print(f'{colors} Theme ({i}): {theme['name']}\n{comp_colors} Wallpaper: {theme['wallpaper']}') os.system(f'viu {theme['wallpaper']} -w 50') - print('[bold green]Select theme (IE, 4)') + print(f'[bold green]Select theme (0, {num_themes})') while True: |
