diff --git a/forms/advanced-scene-switcher.ui b/forms/advanced-scene-switcher.ui
index 9ea4c17b..b8982ec8 100644
--- a/forms/advanced-scene-switcher.ui
+++ b/forms/advanced-scene-switcher.ui
@@ -364,6 +364,39 @@
Window Title
+ -
+
+
-
+
+
+ https://regexr.com
+
+
+ <html><head/><body><p>WARNING! Entries require valid RegEx to function, otherwise they will silently fail. You can check syntax and matches using <a href="https://regexr.com"><span style=" text-decoration: underline; color:#268bd2;">RegExr</span></a></p></body></html>
+
+
+ Qt::AutoText
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
-
-
diff --git a/src/window-title-switch.cpp b/src/window-title-switch.cpp
index ce24f448..899baca5 100644
--- a/src/window-title-switch.cpp
+++ b/src/window-title-switch.cpp
@@ -228,53 +228,35 @@ void SceneSwitcher::on_ignoreWindows_currentRowChanged(int idx)
void SwitcherData::checkWindowTitleSwitch(bool& match, OBSWeakSource& scene, OBSWeakSource& transition)
{
- //check if title should be ignored
string title;
+
+ // Check if current window is ignored
GetCurrentWindowTitle(title);
for (auto& window : ignoreWindowsSwitches)
{
- try
- {
- bool matches = regex_match(title, regex(window));
- if (matches)
- {
- title = lastTitle;
- break;
- }
- }
- catch (const regex_error&)
+ // True if ignored switch matches title
+ bool matches = QString::fromStdString(title).contains(QRegularExpression(window.c_str()));
+ if (matches)
{
+ title = lastTitle;
+ break;
}
}
lastTitle = title;
- //direct match
+ // Check for regex match
for (WindowSceneSwitch& s : windowSwitches)
{
- if (s.window == title)
+ // True if window switch matches title
+ bool matches = QString::fromStdString(title).contains(QRegularExpression(s.window.c_str()));
+ // True if fullscreen is disabled OR window is fullscreen
+ bool fullscreen = (!s.fullscreen || isFullscreen());
+ if (matches && fullscreen)
{
- match = !s.fullscreen || (s.fullscreen && isFullscreen());
+ match = true;
scene = s.scene;
transition = s.transition;
- return;
+ break;
}
}
- //regex match
- for (WindowSceneSwitch& s : windowSwitches)
- {
- try
- {
- bool matches = regex_match(title, regex(s.window));
- if (matches)
- {
- match = !s.fullscreen || (s.fullscreen && isFullscreen());
- scene = s.scene;
- transition = s.transition;
- }
- }
- catch (const regex_error&)
- {
- }
- }
-
}