REF get root dir from conky.conf
This commit is contained in:
parent
bdca0c6511
commit
c9918ba358
|
@ -1,5 +1,7 @@
|
|||
local update_interval = 1 -- in seconds
|
||||
|
||||
local conky_dir = debug.getinfo(1).source:match("@?(.*/)")
|
||||
|
||||
conky.config = {
|
||||
background = false,
|
||||
|
||||
|
@ -30,9 +32,9 @@ conky.config = {
|
|||
no_buffers = true,
|
||||
|
||||
-- Lua Load
|
||||
lua_load = '~/.config/conky/main.lua',
|
||||
lua_load = conky_dir..'main.lua',
|
||||
lua_draw_hook_post = 'main',
|
||||
lua_startup_hook = string.format('start %f', update_interval)
|
||||
lua_startup_hook = string.format('start %f %s', update_interval, conky_dir)
|
||||
}
|
||||
|
||||
--control updates entirely in lua
|
||||
|
|
41
main.lua
41
main.lua
|
@ -1,5 +1,15 @@
|
|||
local conky_dir = debug.getinfo(1).source:match("@?(.*/)")
|
||||
local subdirs = {
|
||||
--------------------------------------------------------------------------------
|
||||
-- startup - this is where the modules are compiled and arranged
|
||||
|
||||
local draw_dynamic
|
||||
|
||||
local __cairo_xlib_surface_create
|
||||
local __cairo_create
|
||||
local __cairo_surface_destroy
|
||||
local __cairo_destroy
|
||||
|
||||
function conky_start(update_interval, conky_dir)
|
||||
local subdirs = {
|
||||
'?.lua',
|
||||
'drawing/?.lua',
|
||||
'schema/?.lua',
|
||||
|
@ -12,24 +22,23 @@ local subdirs = {
|
|||
'core/widget/line/?.lua',
|
||||
'lib/share/lua/5.4/?.lua',
|
||||
'lib/share/lua/5.4/?/init.lua',
|
||||
}
|
||||
}
|
||||
|
||||
for i = 1, #subdirs do
|
||||
for i = 1, #subdirs do
|
||||
package.path = package.path..';'..conky_dir..subdirs[i]
|
||||
end
|
||||
end
|
||||
|
||||
package.cpath = package.cpath..';'..conky_dir..'lib/lib/lua/5.4/?.so;'
|
||||
package.cpath = package.cpath..';'..conky_dir..'lib/lib/lua/5.4/?.so;'
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- startup - this is where the modules are compiled and arranged
|
||||
require 'cairo'
|
||||
|
||||
require 'cairo'
|
||||
__cairo_xlib_surface_create = cairo_xlib_surface_create
|
||||
__cairo_create = cairo_create
|
||||
__cairo_surface_destroy = cairo_surface_destroy
|
||||
__cairo_destroy = cairo_destroy
|
||||
|
||||
local compile = require 'compile'
|
||||
local compile = require 'compile'
|
||||
|
||||
local draw_dynamic
|
||||
|
||||
function conky_start(update_interval)
|
||||
conky_set_update_interval(update_interval)
|
||||
|
||||
draw_dynamic = compile(update_interval, conky_dir..'config.yml')
|
||||
|
@ -38,12 +47,6 @@ end
|
|||
--------------------------------------------------------------------------------
|
||||
-- main loop - where all the drawing/updating happens
|
||||
|
||||
|
||||
local __cairo_xlib_surface_create = cairo_xlib_surface_create
|
||||
local __cairo_create = cairo_create
|
||||
local __cairo_surface_destroy = cairo_surface_destroy
|
||||
local __cairo_destroy = cairo_destroy
|
||||
|
||||
local updates = -2 -- this accounts for the first few spazzy iterations
|
||||
|
||||
function conky_main()
|
||||
|
|
Loading…
Reference in New Issue