fix: auto-deploy conky conf
This commit is contained in:
		
							parent
							
								
									31d77f652a
								
							
						
					
					
						commit
						9e37b6d531
					
				|  | @ -6,7 +6,8 @@ After=conky.service | |||
| Type=oneshot | ||||
| WorkingDirectory=/home/citrullux/ModernOSLabs/src | ||||
| ExecStart=/usr/bin/python3 /home/citrullux/ModernOSLabs/src/main.py -f | ||||
| Restart=always | ||||
| Restart=on-failure | ||||
| RestartSec=30 | ||||
| 
 | ||||
| [Install] | ||||
| WantedBy=default.target | ||||
|  | @ -5,19 +5,19 @@ from time import sleep | |||
| 
 | ||||
| def config_desktop(lines: list, homeDir: Path) -> None: | ||||
|     lines[44] = "    own_window_type = 'desktop'," + "\n" | ||||
|     with open(os.path.join(homeDir, ".config/conky/conky.config"), "w") as config: | ||||
|     with open(os.path.join(homeDir, ".config/conky/conky.conf"), "w") as config: | ||||
|         config.writelines(lines) | ||||
| 
 | ||||
| 
 | ||||
| def config_override(lines: list, homeDir: Path) -> None: | ||||
|     lines[44] = "    own_window_type = 'override'," + "\n" | ||||
|     with open(os.path.join(homeDir, ".config/conky/conky.config"), "w") as config: | ||||
|     with open(os.path.join(homeDir, ".config/conky/conky.conf"), "w") as config: | ||||
|         config.writelines(lines) | ||||
| 
 | ||||
| 
 | ||||
| def conky_fix() -> None: | ||||
|     homeDir = Path(os.getenv("HOME")) | ||||
|     with open(os.path.join(homeDir, ".config/conky/conky.config"), "r") as config: | ||||
|     with open(os.path.join(homeDir, ".config/conky/conky.conf"), "r") as config: | ||||
|         lines = config.readlines() | ||||
|         if lines[44] != "    own_window_type = 'desktop'," + "\n": | ||||
|             config_desktop(lines, homeDir) | ||||
|  |  | |||
|  | @ -11,17 +11,36 @@ def install() -> None: | |||
|     homeDir = Path(os.getenv("HOME")) | ||||
| 
 | ||||
|     # Service file change for userspace | ||||
|     pythonPath = ( | ||||
|         subprocess.check_output("which python3", shell=True).decode("utf-8").strip() | ||||
|     ) | ||||
| 
 | ||||
|     # Fix for weather service | ||||
|     with open(os.path.join(projectDir, "services/wthrc.service"), "r") as service: | ||||
|         lines = service.readlines() | ||||
|     lines[5] = "WorkingDirectory=" + os.path.join(projectDir, "src") + "\n" | ||||
|     lines[6] = ( | ||||
|         "ExecStart=/usr/bin/python3 " + os.path.join(projectDir, "src/main.py") + "\n" | ||||
|         "ExecStart=" + pythonPath + " " + os.path.join(projectDir, "src/main.py") + "\n" | ||||
|     ) | ||||
|     with open(os.path.join(projectDir, "services/wthrc.service"), "w") as service: | ||||
|         service.writelines(lines) | ||||
| 
 | ||||
|     # Fix for conky service | ||||
|     with open(os.path.join(projectDir, "services/conkyconf.service"), "r") as service: | ||||
|         lines = service.readlines() | ||||
|     lines[6] = "WorkingDirectory=" + os.path.join(projectDir, "src") + "\n" | ||||
|     lines[7] = ( | ||||
|         "ExecStart=" | ||||
|         + pythonPath | ||||
|         + " " | ||||
|         + os.path.join(projectDir, "src/main.py -f") | ||||
|         + "\n" | ||||
|     ) | ||||
|     with open(os.path.join(projectDir, "services/conkyconf.service"), "w") as service: | ||||
|         service.writelines(lines) | ||||
| 
 | ||||
|     serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/")) | ||||
|     services = ["wthrc.service", "conky.service"] | ||||
|     services = ["wthrc.service", "conky.service", "conkyconf.service"] | ||||
|     if serviceDirExist: | ||||
|         delivered = filecmp.cmpfiles( | ||||
|             os.path.join(projectDir, "services/"), | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user