Prevents project path from missing ending path separator
This commit is contained in:
parent
254c11cb8f
commit
0e1a018950
21
conky.lua
21
conky.lua
@ -3,31 +3,32 @@
|
||||
|
||||
|
||||
-- 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/"
|
||||
local project_path = (os.getenv('CONKY_PATH') or (os.getenv('HOME') .. "/.conky/SimpleConkyScript"))
|
||||
if string.sub(project_path, -1) ~= '/' then project_path = project_path .. '/' end
|
||||
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)
|
||||
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)
|
||||
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()
|
||||
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'])
|
||||
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)
|
||||
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user