ModernOSWeather/src/fix.py

29 lines
955 B
Python
Raw Permalink Normal View History

2024-10-15 18:16:19 +03:00
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"
2024-10-16 13:14:12 +03:00
with open(os.path.join(homeDir, ".config/conky/conky.conf"), "w") as config:
2024-10-15 18:16:19 +03:00
config.writelines(lines)
def config_override(lines: list, homeDir: Path) -> None:
lines[44] = " own_window_type = 'override'," + "\n"
2024-10-16 13:14:12 +03:00
with open(os.path.join(homeDir, ".config/conky/conky.conf"), "w") as config:
2024-10-15 18:16:19 +03:00
config.writelines(lines)
def conky_fix() -> None:
homeDir = Path(os.getenv("HOME"))
2024-10-16 13:14:12 +03:00
with open(os.path.join(homeDir, ".config/conky/conky.conf"), "r") as config:
2024-10-15 18:16:19 +03:00
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)