35 lines
1.5 KiB
Lua
35 lines
1.5 KiB
Lua
-- HorlogeSkynet's Lua script (for Conky) -- Conky configuration file
|
|
-- <https://git.forestier.app/HorlogeSkynet/SimpleConkyScript.git>
|
|
|
|
|
|
-- Locations of the project directory and Lua scripts.
|
|
local PROJECT_PATH = (os.getenv('CONKY_PATH') or (os.getenv('HOME') .. "/.conky/SimpleConkyScript/"))
|
|
local LUA_SOURCES = PROJECT_PATH .. "lua/"
|
|
|
|
-- Instantiate and populate a (first) `config` singleton.
|
|
-- We voluntary use an `assert` here to make Conky output a clear error message when `loadfile` failed.
|
|
local config = assert(loadfile(LUA_SOURCES .. 'config.lua'))(PROJECT_PATH)
|
|
|
|
-- Manually load the `system` module, by passing the `config` object to it.
|
|
local system = loadfile(LUA_SOURCES .. 'system.lua')(config)
|
|
|
|
|
|
-- Fetch basic settings from the user externalized configuration file.
|
|
conky.config = config.get_entries('settings').conky
|
|
|
|
-- For future computations, fetch the current screen dimensions.
|
|
local WIDTH, HEIGHT = system.get_screen_resolution()
|
|
|
|
-- Manually configure the surface dimensions, based on the user-defined gaps.
|
|
conky.config['minimum_width'] = WIDTH - (2 * conky.config['gap_x'])
|
|
conky.config['minimum_height'] = HEIGHT - (2 * conky.config['gap_y'])
|
|
|
|
-- Manually add our own Lua-relative stuffs.
|
|
conky.config['lua_load'] = (LUA_SOURCES .. 'main.lua')
|
|
conky.config['lua_draw_hook_pre'] = string.format("main %s %d %d", PROJECT_PATH, WIDTH, HEIGHT)
|
|
conky.config['lua_startup_hook'] = string.format("startup %s", PROJECT_PATH)
|
|
|
|
|
|
-- Only Lua instructions will be executed, so the `text` content is left empty.
|
|
conky.text = [[]]
|