diff options
| author | zakk4223 <zakk@rsdio.com> | 2025-01-09 14:52:26 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-09 20:52:26 +0000 |
| commit | 2d1ebadb9b65ef8d57f998031f022b29842b40e4 (patch) | |
| tree | 3b403c390db3ef7a7c0f358bf3293972832308d7 /src/Compositor.cpp | |
| parent | e66eab7b6a90514251439f661454c536afa3e5c8 (diff) | |
selectors: add a tag: to for matching window tag(s) by regex (#8985)
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 3d159042..79574084 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2401,6 +2401,9 @@ PHLWINDOW CCompositor::getWindowByRegex(const std::string& regexp_) { } else if (regexp.starts_with("initialtitle:")) { mode = MODE_INITIAL_TITLE_REGEX; regexCheck = regexp.substr(13); + } else if (regexp.starts_with("tag:")) { + mode = MODE_TAG_REGEX; + regexCheck = regexp.substr(4); } else if (regexp.starts_with("address:")) { mode = MODE_ADDRESS; matchCheck = regexp.substr(8); @@ -2438,6 +2441,18 @@ PHLWINDOW CCompositor::getWindowByRegex(const std::string& regexp_) { continue; break; } + case MODE_TAG_REGEX: { + bool tagMatched = false; + for (auto const& t : w->m_tags.getTags()) { + if (RE2::FullMatch(t, regexCheck)) { + tagMatched = true; + break; + } + } + if (!tagMatched) + continue; + break; + } case MODE_ADDRESS: { std::string addr = std::format("0x{:x}", (uintptr_t)w.get()); if (matchCheck != addr) |
