summaryrefslogtreecommitdiff
path: root/src/update_polybar.py
diff options
context:
space:
mode:
authorChandler Justice <chandler@cock.li>2023-12-09 00:31:22 -0700
committerChandler Justice <chandler@cock.li>2023-12-09 00:31:22 -0700
commit7382992e00b104232454dfd3ef5f355fa3cb4095 (patch)
treee271a76cbf0e80151cd9bca14695b5ad52d71502 /src/update_polybar.py
parent8269c373599e34b0fe4ffd1542420286dded0739 (diff)
refactor complete
Diffstat (limited to 'src/update_polybar.py')
-rw-r--r--src/update_polybar.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/update_polybar.py b/src/update_polybar.py
new file mode 100644
index 0000000..ff395c6
--- /dev/null
+++ b/src/update_polybar.py
@@ -0,0 +1,24 @@
+
+
+def updatePolybarTheme(config_path: str, colors: list, compliments: list):
+ print('[bold red]Updating polybar color scheme')
+ data = ''
+ with open(config_path, 'r') as file:
+ data = file.readlines()
+ for i,line in enumerate(data):
+ #update colors
+ if "background =" in line and i == 19:
+ data[i] = 'background = ' + colors[0] + '\n'
+ if "background-alt =" in line and i == 20:
+ data[i] = 'background-alt = ' + colors[1] + '\n'
+ if "foreground =" in line and i == 21:
+ data[i] = 'foreground = ' + compliments[0] + '\n'
+ if "primary =" in line and i == 22:
+ data[i] = 'primary = ' + compliments[1] + '\n'
+ if "secondary =" in line and i == 23:
+ data[i] = 'secondary = ' + compliments[2] + '\n'
+ if "disabled =" in line and i == 25:
+ data[i] = 'disabled = ' + colors[2] + '\n'
+ with open(config_path, 'w') as file:
+ file.writelines(data)
+