diff options
| author | Lichie <90825386+lichie567@users.noreply.github.com> | 2026-05-03 10:55:47 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-03 18:55:47 +0100 |
| commit | 6a7abd00379b4f37b468bc2d0e717d4ba293efe1 (patch) | |
| tree | d94eb1a5662ddc992d6dd2b3b6dc63aa97135fcc /src/config | |
| parent | 21fa9b2ee27227c964fdeb8090d98255edb89bec (diff) | |
config/lua: add clear tag api (#14273)
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/lua/bindings/LuaBindingsDispatchers.cpp | 11 | ||||
| -rw-r--r-- | src/config/shared/actions/ConfigActions.cpp | 13 | ||||
| -rw-r--r-- | src/config/shared/actions/ConfigActions.hpp | 1 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/config/lua/bindings/LuaBindingsDispatchers.cpp b/src/config/lua/bindings/LuaBindingsDispatchers.cpp index 4fd332eb..32b4e2bf 100644 --- a/src/config/lua/bindings/LuaBindingsDispatchers.cpp +++ b/src/config/lua/bindings/LuaBindingsDispatchers.cpp @@ -563,6 +563,10 @@ static int dsp_tagWindow(lua_State* L) { return Internal::checkResult(L, CA::tag(lua_tostring(L, lua_upvalueindex(1)), Internal::windowFromUpval(L, 2))); } +static int dsp_clearTags(lua_State* L) { + return Internal::checkResult(L, CA::clearTags(Internal::windowFromUpval(L, 1))); +} + static int dsp_toggleSwallow(lua_State* L) { return Internal::checkResult(L, CA::toggleSwallow()); } @@ -915,6 +919,12 @@ static int hlWindowTag(lua_State* L) { return 1; } +static int hlWindowClearTags(lua_State* L) { + Internal::pushWindowUpval(L, 1); + lua_pushcclosure(L, dsp_clearTags, 1); + return 1; +} + static int hlWindowToggleSwallow(lua_State* L) { lua_pushcclosure(L, dsp_toggleSwallow, 0); return 1; @@ -1248,6 +1258,7 @@ void Internal::registerDispatcherBindings(lua_State* L) { Internal::setFn(L, "center", hlWindowCenter); Internal::setFn(L, "cycle_next", hlWindowCycleNext); Internal::setFn(L, "tag", hlWindowTag); + Internal::setFn(L, "clear_tags", hlWindowClearTags); Internal::setFn(L, "toggle_swallow", hlWindowToggleSwallow); Internal::setFn(L, "pin", hlWindowPin); Internal::setFn(L, "bring_to_top", hlWindowBringToTop); diff --git a/src/config/shared/actions/ConfigActions.cpp b/src/config/shared/actions/ConfigActions.cpp index 5db1aaf1..7111afd8 100644 --- a/src/config/shared/actions/ConfigActions.cpp +++ b/src/config/shared/actions/ConfigActions.cpp @@ -605,6 +605,19 @@ ActionResult Actions::tag(const std::string& tagStr, std::optional<PHLWINDOW> w) return {}; } +ActionResult Actions::clearTags(std::optional<PHLWINDOW> w) { + auto window = xtract(w); + if (!window) + return {}; + + if (window->m_ruleApplicator->m_tagKeeper.clearTags()) { + window->m_ruleApplicator->propertiesChanged(Desktop::Rule::RULE_PROP_TAG); + window->updateDecorationValues(); + } + + return {}; +} + ActionResult Actions::swapNext(const bool next, std::optional<PHLWINDOW> w) { auto window = xtract(w); if (!window) diff --git a/src/config/shared/actions/ConfigActions.hpp b/src/config/shared/actions/ConfigActions.hpp index 0f16aff7..6ddf64d9 100644 --- a/src/config/shared/actions/ConfigActions.hpp +++ b/src/config/shared/actions/ConfigActions.hpp @@ -53,6 +53,7 @@ namespace Config::Actions { ActionResult move(const Vector2D& pos, bool relative = false, std::optional<PHLWINDOW> window = std::nullopt /* Active */); ActionResult cycleNext(const bool next, std::optional<bool> onlyTiled, std::optional<bool> onlyFloating, std::optional<PHLWINDOW> window = std::nullopt /* Active */); ActionResult tag(const std::string& tag, std::optional<PHLWINDOW> window = std::nullopt /* Active */); + ActionResult clearTags(std::optional<PHLWINDOW> w = std::nullopt); ActionResult pass(std::optional<PHLWINDOW> window = std::nullopt /* Active */); ActionResult pass(uint32_t modMask, uint32_t key, std::optional<PHLWINDOW> window = std::nullopt /* Active */); ActionResult sendKeyState(uint32_t modMask, uint32_t key, uint32_t state, std::optional<PHLWINDOW> window = std::nullopt /* Active */); |
