From c8f2a2635ec90499bd2ec75969f222f398c1bbc5 Mon Sep 17 00:00:00 2001 From: Chandler Justice Date: Mon, 11 Dec 2023 20:36:30 -0700 Subject: refactor complete --- src/get_args.py | 10 ++++++++++ src/instant_rice.py | 16 ++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 src/get_args.py (limited to 'src') diff --git a/src/get_args.py b/src/get_args.py new file mode 100644 index 0000000..0001abb --- /dev/null +++ b/src/get_args.py @@ -0,0 +1,10 @@ +import user_interface + +def get_args(args): + if len(args) != 2: + pass + elif '-r' in args: + img_path = user_interface.pickRandomWallpaper() + else: + img_path = args[1] + return img_path diff --git a/src/instant_rice.py b/src/instant_rice.py index 87c9968..6d02be6 100644 --- a/src/instant_rice.py +++ b/src/instant_rice.py @@ -4,26 +4,22 @@ import user_interface import update_rofi import update_i3 import update_polybar +from get_args import get_args from paths import Paths def main(): - if '-r' in sys.argv: - img_path = user_interface.pickRandomWallpaper() - else: - img_path = sys.argv[1] - + img_path = get_args(sys.argv) hex_colors, hex_compliments = user_interface.colorPickerUI(img_path) + if 'polybar' in Paths: update_polybar.updatePolybarTheme(Paths['polybar'], hex_colors, hex_compliments) if 'rofi' in Paths: update_rofi.updateRofiTheme(Paths['rofi'], hex_colors, hex_compliments) if 'i3' in Paths: update_dmenu = True if ('-dmenu' in sys.argv) else False - if '--nolock' in sys.argv: - update_i3.updatei3Theme(Paths['i3'], img_path, hex_colors, hex_compliments, False, update_dmenu) - else: - update_i3.updatei3Theme(Paths['i3'], img_path, hex_colors, hex_compliments, True, update_dmenu) - + generate_i3lock = False if ('--nolock' in sys.argv) else True + update_i3.updatei3Theme(Paths['i3'], img_path, hex_colors, hex_compliments, generate_i3lock, update_dmenu) + if __name__ == '__main__': -- cgit v1.2.3