ENH call systemd from within conky

This commit is contained in:
Nathan Dwarshuis 2021-08-08 19:51:45 -04:00
parent f13e01c7b4
commit b70f19b8ad
2 changed files with 10 additions and 2 deletions

View File

@ -31,7 +31,8 @@ conky.config = {
--Lua Load
lua_load = '~/.config/conky/main.lua',
lua_draw_hook_post = 'main',
lua_startup_hook = string.format('start %f', update_interval)
lua_startup_hook = string.format('start %f', update_interval),
lua_shutdown_hook = 'stop'
}
--control updates entirely in lua

View File

@ -38,6 +38,10 @@ function conky_start(update_interval)
local devices = {'sda', 'nvme0n1'}
local battery = 'BAT0'
local fs_paths = {'/', '/boot', '/home', '/mnt/data', '/mnt/dcache', "/tmp"}
local STATS_FILE = '/tmp/.conky_pacman'
-- TODO so far this seems like the best way to 'fork' a process from conky
i_o.execute_cmd('systemctl --user start conky_pacman.timer')
local mem = memory(update_freq)
local rw = readwrite(update_freq, devices)
@ -57,7 +61,6 @@ function conky_start(update_interval)
{pcm.static, fs.static, pwr.static, mem.static}
)
local STATS_FILE = '/tmp/.conky_pacman'
draw_dynamic = function(cr, _updates)
-- draw static components
@ -91,6 +94,10 @@ function conky_start(update_interval)
end
end
function conky_stop()
i_o.execute_cmd('systemctl --user stop conky_pacman.timer')
end
local updates = -2 -- this accounts for the first few spazzy iterations
function conky_main()