Files
diya-shell/hooks/hooks.lua
Dany LE 377eaf7d84 feat: Add hook mechanism + use gsettings:
- Allow to install hooks that execute lua scripts on changes of watched files
- Use gsetting to store shell parameters such as: theme, idle-timeout, etc.
2025-10-13 18:08:50 +02:00

21 lines
910 B
Lua

local script_path = debug.getinfo(1, "S").source:sub(2)
local script_dir = script_path:match("(.*/)")
local schemas_dir = diya.system.user_data_dir() .. "/glib-2.0/schemas"
-- create the schemas dir if not exists
diya.system.mkdir(schemas_dir)
local script_compile_schemas = script_dir .. "/compile_schemas.lua"
-- install hook on schemas dir
diya.hook.changed(schemas_dir, script_compile_schemas, false)
local session_schemas = schemas_dir.."/dev.iohub.diya.session.gschema.xml"
if not diya.system.file_exists(session_schemas) then
-- copy session schemas if not exists
diya.system.save_resource("/dev/iohub/diya/shell/schemas/session.gschema.xml", session_schemas)
end
local compiled_schemas = diya.system.user_config_dir() .. "/diya/schemas/gschemas.compiled"
local script_check_schema = script_dir .. "/check_compiled_schemas.lua"
diya.hook.changed(compiled_schemas, script_check_schema, true)