From 871d4b7b8d471e05794dd4c1128d7c2d91d48d56 Mon Sep 17 00:00:00 2001 From: Chandler Justice Date: Sat, 9 Dec 2023 00:35:36 -0700 Subject: updated readme --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index da24a09..557eccd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ -# Dynamic Theme Switcher +``` + _ _ _ _ +(_)_ __ ___| |_ __ _ _ __ | |_ _ __(_) ___ ___ +| | '_ \/ __| __/ _` | '_ \| __| | '__| |/ __/ _ \ +| | | | \__ \ || (_| | | | | |_ | | | | (_| __/ +|_|_| |_|___/\__\__,_|_| |_|\__| |_| |_|\___\___| +``` + ![desktop with theme switcher](demo.png) This program will take in an image and generate a color palette based on the image. This palette will be determined by first doing a KMeans analysis on the image to find the most prominent colors, and then generating a complimentary color for each of the most prominent colors. After determining the colors, the program will automatically update the colors for i3 and Polybar to the new color scheme. Next, the program will update the background displayed to the image passed in and prompt the user to re-load i3. -- cgit v1.2.3 From c8f2a2635ec90499bd2ec75969f222f398c1bbc5 Mon Sep 17 00:00:00 2001 From: Chandler Justice Date: Mon, 11 Dec 2023 20:36:30 -0700 Subject: refactor complete --- README.md | 25 ++++++++++++++++++++----- src/get_args.py | 10 ++++++++++ src/instant_rice.py | 16 ++++++---------- 3 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 src/get_args.py (limited to 'README.md') diff --git a/README.md b/README.md index 557eccd..cf53e7c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ This program will take in an image and generate a color palette based on the ima ## Usage -`python3 newTheme.py [image]` +`python3 instant_rice.py [image_path] [-r] [--nolock]` + - `-r`: pick a random image from your `Paths['wallpapers']` directory + - `--nolock`: bypass generating an i3 lock screen ## Requirements @@ -24,9 +26,22 @@ This program will take in an image and generate a color palette based on the ima - Clone this repo to a safe place - Modify this script to adapt to your configuration - - With polybar, it is hard to uniquely identify the lines for the colors without knowing the line number, for this reason, the script will look for a specific line number to modify, and depending on your configuration you might have to change these line numbers. I use modified version of the stock config files for `i3` and `polybar`, so if your config is based on the stock config file, no changes *should* be necessary. - - Update `paths.py` with the appropiate paths to your config files + - With Polybar, it is hard to uniquely identify the lines for the colors without knowing the line number, for this reason, the script will look for a specific line number to modify, and depending on your configuration you might have to change these line numbers. I use modified version of the stock config files for `i3` and `polybar`, so if your config is based on the stock config file, no changes *should* be necessary. + - Update `paths.py` with the appropriate paths to your config files - In your `.bashrc`, create an alias to the python script - - IE, `alias newtheme='python3 /home/chandler/Documents/newColors/newTheme.py'` + - IE, `alias rice='python3 /home/chandler/Documents/newColors/newTheme.py'` - reload your bash config/open & close your terminal - - apply a new theme to your system! + - apply a new theme to your system (Ex: `rice -r`)! + + ## Configuration + + Instant Rice stores the locations of your configuration files alongside other settings in the `paths.py` folder within a python dictionary. Before using the program, verify the directories and settings are configured to your system. + below is the default paths directory configured for my system: + ``` + Paths = { + 'i3': '/home/chandler/.config/i3/config', + 'polybar': '/home/chandler/.config/polybar/config.ini', + 'wallpapers': '/home/chandler/Pictures/papes/', + 'lockscreen': '/home/chandler/.config/i3/' + } + ``` 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