summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE20
-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
5 files changed, 72 insertions, 23 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..54bdcf1
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2024 Chandler Justice <chqn@chandlerjustice.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
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)