Add controls for verbosity level
This allows the config to be exactly as verbose as kiwmi, or to change the verbosity level at runtime (e.g. using kiwmic). It uses numbers, because they are much easier to handle on both sides and add only little inconvenience to the user.
This commit is contained in:
parent
465904a2d5
commit
f1c2262ff6
2 changed files with 41 additions and 0 deletions
|
@ -191,6 +191,25 @@ l_kiwmi_server_schedule(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
l_kiwmi_server_set_verbosity(lua_State *L)
|
||||||
|
{
|
||||||
|
luaL_checkudata(L, 1, "kiwmi_server");
|
||||||
|
luaL_checktype(L, 2, LUA_TNUMBER);
|
||||||
|
|
||||||
|
int verbosity = lua_tointeger(L, 2);
|
||||||
|
|
||||||
|
if (verbosity < WLR_SILENT) {
|
||||||
|
verbosity = WLR_SILENT;
|
||||||
|
} else if (verbosity >= WLR_LOG_IMPORTANCE_LAST) {
|
||||||
|
verbosity = WLR_DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_log_init((enum wlr_log_importance)verbosity, NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
l_kiwmi_server_spawn(lua_State *L)
|
l_kiwmi_server_spawn(lua_State *L)
|
||||||
{
|
{
|
||||||
|
@ -241,6 +260,18 @@ l_kiwmi_server_unfocus(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
l_kiwmi_server_verbosity(lua_State *L)
|
||||||
|
{
|
||||||
|
luaL_checkudata(L, 1, "kiwmi_server");
|
||||||
|
|
||||||
|
int verbosity = (int)wlr_log_get_verbosity();
|
||||||
|
|
||||||
|
lua_pushinteger(L, verbosity);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
l_kiwmi_server_view_at(lua_State *L)
|
l_kiwmi_server_view_at(lua_State *L)
|
||||||
{
|
{
|
||||||
|
@ -284,9 +315,11 @@ static const luaL_Reg kiwmi_server_methods[] = {
|
||||||
{"output_at", l_kiwmi_server_output_at},
|
{"output_at", l_kiwmi_server_output_at},
|
||||||
{"quit", l_kiwmi_server_quit},
|
{"quit", l_kiwmi_server_quit},
|
||||||
{"schedule", l_kiwmi_server_schedule},
|
{"schedule", l_kiwmi_server_schedule},
|
||||||
|
{"set_verbosity", l_kiwmi_server_set_verbosity},
|
||||||
{"spawn", l_kiwmi_server_spawn},
|
{"spawn", l_kiwmi_server_spawn},
|
||||||
{"stop_interactive", l_kiwmi_server_stop_interactive},
|
{"stop_interactive", l_kiwmi_server_stop_interactive},
|
||||||
{"unfocus", l_kiwmi_server_unfocus},
|
{"unfocus", l_kiwmi_server_unfocus},
|
||||||
|
{"verbosity", l_kiwmi_server_verbosity},
|
||||||
{"view_at", l_kiwmi_server_view_at},
|
{"view_at", l_kiwmi_server_view_at},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,6 +50,10 @@ Quit kiwmi.
|
||||||
Call `callback` after `delay` ms.
|
Call `callback` after `delay` ms.
|
||||||
Callback get passed itself, so that it can easily reregister itself.
|
Callback get passed itself, so that it can easily reregister itself.
|
||||||
|
|
||||||
|
#### kiwmi:set_verbosity(level)
|
||||||
|
|
||||||
|
Sets verbosity of kiwmi to the level specified with a number (see `kiwmi:verbosity()`).
|
||||||
|
|
||||||
#### kiwmi:spawn(command)
|
#### kiwmi:spawn(command)
|
||||||
|
|
||||||
Spawn a new process.
|
Spawn a new process.
|
||||||
|
@ -63,6 +67,10 @@ Stops an interactive move or resize.
|
||||||
|
|
||||||
Unfocus the currently focused view.
|
Unfocus the currently focused view.
|
||||||
|
|
||||||
|
#### kiwmi:verbosity()
|
||||||
|
|
||||||
|
Returns the numerical verbosity level of kiwmi (value of one of `wlr_log_importance`, silent = 0, error = 1, info = 2, debug = 3).
|
||||||
|
|
||||||
#### kiwmi:view_at(lx, ly)
|
#### kiwmi:view_at(lx, ly)
|
||||||
|
|
||||||
Get the view at a specified position.
|
Get the view at a specified position.
|
||||||
|
|
Loading…
Reference in a new issue