mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-10 09:29:48 +01:00
selectors: add a tag: to for matching window tag(s) by regex (#8985)
This commit is contained in:
parent
e66eab7b6a
commit
2d1ebadb9b
2 changed files with 16 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -49,6 +49,7 @@ enum eFocusWindowMode : uint8_t {
|
|||
MODE_INITIAL_CLASS_REGEX,
|
||||
MODE_TITLE_REGEX,
|
||||
MODE_INITIAL_TITLE_REGEX,
|
||||
MODE_TAG_REGEX,
|
||||
MODE_ADDRESS,
|
||||
MODE_PID,
|
||||
MODE_ACTIVE_WINDOW
|
||||
|
|
Loading…
Reference in a new issue