summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChandler J <cjustice2000@gmail.com>2024-02-24 00:08:21 -0700
committerChandler J <cjustice2000@gmail.com>2024-02-24 00:08:21 -0700
commit4734634389cdbac0e0c9596a4c1737b4fb6c644d (patch)
treecf713a2d62c82beb12c7384173ed7b2d323c1467 /src
parente5171305479b4fe3fea8cdeff5cb8a2ed4e84967 (diff)
early stages of changing config plus license
Diffstat (limited to 'src')
-rw-r--r--src/get_args.py35
-rw-r--r--src/initialize_i3.py0
-rw-r--r--src/initialize_rofi.py15
-rw-r--r--src/instant_rice.py25
4 files changed, 52 insertions, 23 deletions
diff --git a/src/get_args.py b/src/get_args.py
index 6be2ab9..09c5279 100644
--- a/src/get_args.py
+++ b/src/get_args.py
@@ -2,16 +2,45 @@ import user_interface
import os
def get_args(args) -> tuple:
+ # arguments that can be passed into program
dmenu = False
nolock = False
+ initialize = False
+ reconfigure = False
+ nolock = False
if '-r' in args:
img_path = user_interface.pickRandomWallpaper()
else:
img_path = f"{os.getcwd()}/{args[1]}"
-
- if '-dmenu' in args:
+ if '--initialize' in args:
+ initialize = True
+ if '--reconfigure' in args:
+ reconfigure = True
+ if '--dmenu' in args:
dmenu = True
if '--nolock' in args:
nolock = True
- return img_path, dmenu, nolock
+ return img_path, dmenu, nolock, initialize, reconfigure
+
+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""")
diff --git a/src/initialize_i3.py b/src/initialize_i3.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/initialize_i3.py
diff --git a/src/initialize_rofi.py b/src/initialize_rofi.py
index 8b8efdd..cc3fd0a 100644
--- a/src/initialize_rofi.py
+++ b/src/initialize_rofi.py
@@ -27,16 +27,19 @@ def reconfigureRofi() -> None:
file.writelines(data)
else:
# create the rasi config
- file = open(rf'{configPath}config.rasi', 'w')
- file.write('@theme "theme.rasi"')
- file.close()
+ with open(rf'{configPath}config.rasi', 'w') as file:
+ file.write('@theme "theme.rasi"')
# copy the default config from data to .config
dirExists = os.path.isdir(configPath)
if dirExists:
changeConfigContents()
else:
- print('path doesnt exist')
+ # Drop the Rofi theme config in rofi
+ print(f'path doesnt exist. Creating directory {configPath}')
+ os.makedirs(configPath)
+ changeConfigContents()
+ dropRofiTheme()
def dropRofiTheme():
@@ -48,7 +51,3 @@ def dropRofiTheme():
with open(f'{configPath}theme.rasi', 'w') as file:
file.writelines(data)
-
-
-reconfigureRofi()
-dropRofiTheme()
diff --git a/src/instant_rice.py b/src/instant_rice.py
index a55f2c8..e0faa5e 100644
--- a/src/instant_rice.py
+++ b/src/instant_rice.py
@@ -1,20 +1,21 @@
import sys
-import color_engine
import user_interface
import update_rofi
import update_i3
import update_polybar
-from get_args import get_args
+from get_args import get_args,usage
from paths import Paths
if __name__ == '__main__':
- img_path, update_dmenu, i3lock = 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:
- 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 len(sys.argv) > 1:
+ img_path, update_dmenu, nolock, initialize, reconfigure = 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_i3.updatei3Theme(Paths['i3'], img_path, hex_colors, hex_compliments, nolock, update_dmenu)
+ else:
+ usage(sys.argv)