summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/initialize_rofi.py34
-rw-r--r--src/paths.py2
2 files changed, 30 insertions, 6 deletions
diff --git a/src/initialize_rofi.py b/src/initialize_rofi.py
index 621e665..69c8637 100644
--- a/src/initialize_rofi.py
+++ b/src/initialize_rofi.py
@@ -1,23 +1,38 @@
from rich import print
import os
-def initializeRofi() -> None:
+
+uname: str = os.getlogin()
+configPath = f'/home/{uname}/.config/rofi/'
+
+def reconfigureRofi() -> None:
"""
Create a Rofi theme if one is not present with desired defaults to work with InstantRice.
Will pull source file from data dir
"""
print('[bold red]Initializing Rofi Theme')
- uname: str = os.getlogin()
# copy the default config from data to .config
- configPath = f'/home/{uname}/.config/rofi/'
dirExists = os.path.isdir(configPath)
if dirExists:
print('path exists')
if os.path.exists(f'{configPath}config.rasi'):
print('config present')
+ with open(f'{configPath}config.rasi', 'r') as file:
+ data = file.readlines()
+ themeSet = False
+ for i, line in enumerate(data):
+ if '@theme' in line:
+ themeSet = True
+ data[i] = '@theme "theme.rasi"'
+ if not themeSet:
+ data.append('@theme "theme.rasi"')
+ with open(f'{configPath}config.rasi', 'w') as file:
+ file.writelines(data)
else:
# create the rasi config
- pass
+ file = open(rf'{configPath}config.rasi', 'w')
+ file.write('@theme "theme.rasi"')
+ file.close()
else:
print('path doesnt exist')
# add line to rofi config
@@ -26,4 +41,13 @@ def initializeRofi() -> None:
print(uname)
print(dirExists)
-initializeRofi()
+def dropRofiTheme():
+ with open('../data/theme.rasi', 'r') as file:
+ data = file.readlines()
+
+ with open(f'{configPath}theme.rasi', 'w') as file:
+ file.writelines(data)
+
+
+reconfigureRofi()
+dropRofiTheme()
diff --git a/src/paths.py b/src/paths.py
index db3d0ce..b4cf3d5 100644
--- a/src/paths.py
+++ b/src/paths.py
@@ -3,5 +3,5 @@ Paths = {
'polybar': '/home/chandler/.config/polybar/config.ini',
'wallpapers': '/home/chandler/Pictures/papes/',
'lockscreen': '/home/chandler/.config/i3/',
- 'rofi': '/home/chandler/.config/rofi/activetheme.rasi'
+ 'rofi': '/home/chandler/.config/rofi/theme.rasi'
}