add: conky config, edit service

This commit is contained in:
Дмитрий Абдрахманов 2024-10-15 18:16:19 +03:00
parent f277c38797
commit 31d77f652a
5 changed files with 56 additions and 1 deletions

View File

@ -3,9 +3,10 @@
SCRIPT=$(readlink -f "$0") SCRIPT=$(readlink -f "$0")
DIR=$(dirname "$SCRIPT") DIR=$(dirname "$SCRIPT")
# Create dirrectory for systemd scripts # Create dirrectory for systemd and conky scripts
cd $HOME/.config/ cd $HOME/.config/
mkdir -p systemd mkdir -p systemd
mkdir -p conky
cd systemd/ cd systemd/
mkdir -p user mkdir -p user
@ -13,8 +14,14 @@ mkdir -p user
cd "$DIR" cd "$DIR"
cp -ur ../services/* ~/.config/systemd/user cp -ur ../services/* ~/.config/systemd/user
# Copy conky config
cp -ur ../configs/* ~/.config/conky
# Daemon launch # Daemon launch
/usr/bin/systemctl --user daemon-reload /usr/bin/systemctl --user daemon-reload
/usr/bin/systemctl --user enable wthrc.service /usr/bin/systemctl --user enable wthrc.service
/usr/bin/systemctl --user enable conky.service /usr/bin/systemctl --user enable conky.service
/usr/bin/systemctl --user enable conkyconf.service
echo "Done installer" echo "Done installer"

View File

@ -3,4 +3,8 @@
# Launch daemon # Launch daemon
/usr/bin/systemctl --user restart wthrc.service /usr/bin/systemctl --user restart wthrc.service
/usr/bin/systemctl --user restart conky.service /usr/bin/systemctl --user restart conky.service
sleep 5
/usr/bin/systemctl --user restart conkyconf.service
echo "Daemon started" echo "Daemon started"

View File

@ -0,0 +1,12 @@
[Unit]
Description=Service for conky configuration
After=conky.service
[Service]
Type=oneshot
WorkingDirectory=/home/citrullux/ModernOSLabs/src
ExecStart=/usr/bin/python3 /home/citrullux/ModernOSLabs/src/main.py -f
Restart=always
[Install]
WantedBy=default.target

28
src/fix.py Normal file
View File

@ -0,0 +1,28 @@
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.config"), "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:
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:
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)

View File

@ -1,12 +1,16 @@
from installer import install from installer import install
from server import weather_run from server import weather_run
from fix import conky_fix
import argparse import argparse
flags = argparse.ArgumentParser() flags = argparse.ArgumentParser()
flags.add_argument("--install", "-i", action="store_true") flags.add_argument("--install", "-i", action="store_true")
flags.add_argument("--fix", "-f", action="store_true")
args = flags.parse_args() args = flags.parse_args()
if args.install: if args.install:
install() install()
elif args.fix:
conky_fix()
else: else:
weather_run() weather_run()