add: conky config and conky.conf

This commit is contained in:
Дмитрий Абдрахманов 2024-10-11 18:56:25 +03:00
parent 71a1d53f0d
commit f277c38797
5 changed files with 83 additions and 7 deletions

58
configs/conky.conf Normal file
View File

@ -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}
]]

View File

@ -16,4 +16,5 @@ cp -ur ../services/* ~/.config/systemd/user
# 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
echo "Done installer" echo "Done installer"

View File

@ -2,4 +2,5 @@
# 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
echo "Daemon started" echo "Daemon started"

11
services/conky.service Normal file
View File

@ -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

View File

@ -2,30 +2,35 @@ import filecmp
import subprocess import subprocess
import os import os
from time import sleep from time import sleep
from pathlib import Path from pathlib import Path
def install() -> None: def install() -> None:
delivered = False
projectDir = Path(__file__).resolve().parent.parent projectDir = Path(__file__).resolve().parent.parent
homeDir = Path(os.getenv("HOME")) homeDir = Path(os.getenv("HOME"))
serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/"))
delivered = False
# Service file change for userspace # Service file change for userspace
with open(os.path.join(projectDir, "services/wthrc.service"), "r") as service: with open(os.path.join(projectDir, "services/wthrc.service"), "r") as service:
lines = service.readlines() lines = service.readlines()
lines[5] = "WorkingDirectory=" + os.path.join(projectDir, "src") + "\n" 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: with open(os.path.join(projectDir, "services/wthrc.service"), "w") as service:
service.writelines(lines) service.writelines(lines)
serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/"))
services = ["wthrc.service", "conky.service"]
if serviceDirExist: if serviceDirExist:
delivered = filecmp.cmp( delivered = filecmp.cmpfiles(
os.path.join(projectDir, "services/wthrc.service"), os.path.join(projectDir, "services/"),
os.path.join(homeDir, ".config/systemd/user/wthrc.service"), os.path.join(homeDir, ".config/systemd/user/"),
services,
shallow=True, shallow=True,
) )
if delivered[2] != [] or delivered[1] != []:
delivered = bool(False)
if not delivered or not serviceDirExist: if not delivered or not serviceDirExist:
os.environ["DIR"] = str(projectDir) os.environ["DIR"] = str(projectDir)