diff --git a/configs/conky.conf b/configs/conky.conf new file mode 100644 index 0000000..f11f6c6 --- /dev/null +++ b/configs/conky.conf @@ -0,0 +1,58 @@ +-- Conky, a system monitor https://github.com/brndnmtthws/conky +-- +-- This configuration file is Lua code. You can write code in here, and it will +-- execute when Conky loads. You can use it to generate your own advanced +-- configurations. +-- +-- Try this (remove the `--`): +-- +-- print("Loading Conky config") +-- +-- For more on Lua, see: +-- https://www.lua.org/pil/contents.html + +conky.config = { + alignment = 'top_right', + background = false, + border_width = 1, + cpu_avg_samples = 2, + default_color = 'white', + default_outline_color = 'white', + default_shade_color = 'white', + double_buffer = true, + draw_borders = false, + draw_graph_borders = false, + draw_outline = false, + draw_shades = false, + extra_newline = false, + font = 'DejaVu Serif:size=18', + gap_x = 15, + gap_y = 15, + minimum_height = 5, + minimum_width = 5, + net_avg_samples = 2, + no_buffers = true, + out_to_console = false, + out_to_ncurses = false, + out_to_stderr = false, + out_to_x = true, + own_window = true, + own_window_argb_visual = true, + own_window_class = 'Conky', + own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager', + own_window_type = 'desktop', + own_window_argb_value = 112, + show_graph_range = false, + show_graph_scale = false, + stippled_borders = 0, + update_interval = 1.0, + uppercase = false, + use_spacer = 'none', + use_xft = true, +} + +conky.text = [[ +${alignc}${color orange}Weather +${alignc}${voffset 15}${color grey}Current +${color grey}${exec cat /home/citrullux/example} +]] \ No newline at end of file diff --git a/scripts/install.sh b/scripts/install.sh index 232bfdc..87a0c65 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -16,4 +16,5 @@ cp -ur ../services/* ~/.config/systemd/user # Daemon launch /usr/bin/systemctl --user daemon-reload /usr/bin/systemctl --user enable wthrc.service +/usr/bin/systemctl --user enable conky.service echo "Done installer" \ No newline at end of file diff --git a/scripts/runner.sh b/scripts/runner.sh index 9a3f29f..e7d3826 100644 --- a/scripts/runner.sh +++ b/scripts/runner.sh @@ -2,4 +2,5 @@ # Launch daemon /usr/bin/systemctl --user restart wthrc.service +/usr/bin/systemctl --user restart conky.service echo "Daemon started" \ No newline at end of file diff --git a/services/conky.service b/services/conky.service new file mode 100644 index 0000000..748ea87 --- /dev/null +++ b/services/conky.service @@ -0,0 +1,11 @@ +[Unit] +Description=Service for conky + +[Service] +Type=simple +Environment="DISPLAY=:0" +ExecStart=/usr/bin/conky +Restart=always + +[Install] +WantedBy=default.target \ No newline at end of file diff --git a/src/installer.py b/src/installer.py index 1e59ec5..64cbb53 100644 --- a/src/installer.py +++ b/src/installer.py @@ -2,30 +2,35 @@ import filecmp import subprocess import os from time import sleep - from pathlib import Path def install() -> None: + delivered = False projectDir = Path(__file__).resolve().parent.parent homeDir = Path(os.getenv("HOME")) - serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/")) - delivered = False # Service file change for userspace 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" + lines[6] = ( + "ExecStart=/usr/bin/python3 " + os.path.join(projectDir, "src/main.py") + "\n" + ) with open(os.path.join(projectDir, "services/wthrc.service"), "w") as service: service.writelines(lines) + serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/")) + services = ["wthrc.service", "conky.service"] if serviceDirExist: - delivered = filecmp.cmp( - os.path.join(projectDir, "services/wthrc.service"), - os.path.join(homeDir, ".config/systemd/user/wthrc.service"), + delivered = filecmp.cmpfiles( + os.path.join(projectDir, "services/"), + os.path.join(homeDir, ".config/systemd/user/"), + services, shallow=True, ) + if delivered[2] != [] or delivered[1] != []: + delivered = bool(False) if not delivered or not serviceDirExist: os.environ["DIR"] = str(projectDir)