diff --git a/conky.conf b/conky.conf index a89a8f5..d473b44 100644 --- a/conky.conf +++ b/conky.conf @@ -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 diff --git a/main.lua b/main.lua index 60ccfea..ac67171 100644 --- a/main.lua +++ b/main.lua @@ -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()