Skip to content

Commit

Permalink
directvt#393 WIP: Lua scripting (window.AlwaysOnTop)
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o committed Jan 3, 2025
1 parent 6aa0e47 commit 4ffa895
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions src/vtm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,40 @@ namespace netxs::app::vtm
});
::lua_settop(lua, 0);
}},
{ "AlwaysOnTop", [](base& boss, auto lua)
{
auto args_count = ::lua_gettop(lua);
if (args_count == 0) // Request.
{
auto zorder = boss.bell::signal(tier::request, e2::form::prop::zorder);
::lua_pushboolean(lua, zorder == zpos::topmost);
}
else // Setup.
{
auto zorder = ::lua_toboolean(lua, 1) ? zpos::topmost : zpos::plain;
boss.bell::signal(tier::preview, e2::form::prop::zorder, zorder);
::lua_settop(lua, 0);
::lua_pushboolean(lua, zorder == zpos::topmost);
}
}},
{ "Close", [](base& boss, auto lua)
{
}},
{ "ShowClosePreview", [](base& boss, auto lua)
{
}},
{ "HideClosePreview", [](base& boss, auto lua)
{
}},
{ "MinimizeWindow", [](base& boss, auto lua)
{
}},
{ "MaximizeWindow", [](base& boss, auto lua)
{
}},
{ "Fullscreen", [](base& boss, auto lua)
{
}},
};
boss.base::plugin<pro::luafx>(proc_map);
//boss.LISTEN(tier::release, e2::runscript, gear)
Expand Down
2 changes: 1 addition & 1 deletion src/vtm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ R"==(
<FocusPrevWindow ="vtm.FocusNextWindow(-1)"/> <!-- Switch focus to the prev desktop window. -->
<FocusNextWindow ="vtm.FocusNextWindow( 1)"/> <!-- Switch focus to the next desktop window. -->

<AlwaysOnTop ="window.AlwaysOnTop()"/> <!-- Toggle AlwaysOnTop window flag. -->
<AlwaysOnTop ="window.AlwaysOnTop(not window.AlwaysOnTop())"/> <!-- Toggle AlwaysOnTop window flag. -->
<CloseWindow ="window.Close()"/> <!-- Close window. -->
<WindowClosePreview ="window.ShowClosePreview()"/> <!-- Pred window close action. -->
<CancelWindowClose ="window.HideClosePreview()"/> <!-- Clear pred-close window state. -->
Expand Down

0 comments on commit 4ffa895

Please sign in to comment.