plugins: Introduce helpers.defaultNullOpts.mkLuaFn (#855)

This allows to avoid calling `mkRaw` on lua functions, as they will get
applied automatically.

This could also help in the future to refactor the use of Lua code to
make it more user-friendly.
This commit is contained in:
traxys 2023-12-29 15:24:42 +01:00 committed by GitHub
parent b38dbdb0dc
commit 1d8e7906c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 140 additions and 119 deletions

View file

@ -71,11 +71,11 @@ in {
trace = "";
};
onOpen = helpers.mkNullOrOption types.str ''
onOpen = helpers.defaultNullOpts.mkLuaFn "nil" ''
Function called when a new window is opened, use for changing win settings/config.
'';
onClose = helpers.mkNullOrOption types.str ''
onClose = helpers.defaultNullOpts.mkLuaFn "nil" ''
Function called when a new window is closed.
'';
@ -130,8 +130,8 @@ in {
}
)
icons;
on_open = helpers.mkRaw onOpen;
on_close = helpers.mkRaw onClose;
on_open = onOpen;
on_close = onClose;
inherit render;
minimum_width = minimumWidth;
inherit fps;