import os from pathlib import Path 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.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.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.conf"), "r") as config: lines = config.readlines() if lines[44] != " own_window_type = 'desktop'," + "\n": config_desktop(lines, homeDir) sleep(5) config_override(lines, homeDir) else: sleep(5) config_override(lines, homeDir)