diff --git a/services/conkyconf.service b/services/conkyconf.service index e8e0f13..3f8b931 100644 --- a/services/conkyconf.service +++ b/services/conkyconf.service @@ -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 \ No newline at end of file diff --git a/src/fix.py b/src/fix.py index f30ef9d..0630b93 100644 --- a/src/fix.py +++ b/src/fix.py @@ -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) diff --git a/src/installer.py b/src/installer.py index 64cbb53..53c2270 100644 --- a/src/installer.py +++ b/src/installer.py @@ -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/"),