diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-07-25 23:17:02 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-07-25 23:17:02 +0530 |
| commit | 031b22e0bb0f1d132731aea3776917731a8ab4ce (patch) | |
| tree | 1c3775d5aba426669a0ea0b8821a7b4b0808aab0 /src/LuaRuntimeApi.hpp | |
| parent | 81dcf7de91c1866d565f7aa9eb38f7fbd1cd7ad7 (diff) | |
| download | null-browser-031b22e0bb0f1d132731aea3776917731a8ab4ce.tar.gz null-browser-031b22e0bb0f1d132731aea3776917731a8ab4ce.zip | |
Add decorations.*.view lua api + support decoration views for open url
Diffstat (limited to 'src/LuaRuntimeApi.hpp')
| -rw-r--r-- | src/LuaRuntimeApi.hpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/LuaRuntimeApi.hpp b/src/LuaRuntimeApi.hpp index b308f56..9f6c631 100644 --- a/src/LuaRuntimeApi.hpp +++ b/src/LuaRuntimeApi.hpp @@ -289,6 +289,18 @@ int lua_api_decorations_get_enabled(lua_State *state) { return 1; } +int lua_api_decorations_get_view(lua_State *state) { + auto type = (DecorationType)lua_tointeger(state, 1); + WindowId win_id = lua_isnoneornil(state, 2) ? lua_tointeger(state, 2) : 0; + auto &router = WindowActionRouter::instance(); + auto view_id = router.fetch_get_decoration_view_id(type, win_id); + if (view_id.has_value()) + lua_pushinteger(state, view_id.value()); + else + lua_pushnil(state); + return 1; +} + // NOLINTNEXTLINE static luaL_Reg internals_api[] = { luaL_Reg{"event_add_listener", &lua_event_register}, @@ -315,5 +327,6 @@ static luaL_Reg internals_api[] = { luaL_Reg{"search_next", &lua_api_search_next}, luaL_Reg{"decorations_set_enabled", &lua_api_decorations_set_enabled}, luaL_Reg{"decorations_get_enabled", &lua_api_decorations_get_enabled}, + luaL_Reg{"decorations_get_view", &lua_api_decorations_get_view}, luaL_Reg{nullptr, nullptr}, }; |
