diff --git a/src/executable-switch.cpp b/src/executable-switch.cpp index 47ad2b49..0f770357 100644 --- a/src/executable-switch.cpp +++ b/src/executable-switch.cpp @@ -133,32 +133,40 @@ void SwitcherData::checkExeSwitch(bool& match, OBSWeakSource& scene, OBSWeakSour GetCurrentWindowTitle(title); for (auto& window : ignoreWindowsSwitches) { + // True if ignored switch equals title + bool equals = (title == window); // True if ignored switch matches title bool matches = QString::fromStdString(title).contains(QRegularExpression(window.c_str())); - if (matches) + + if (equals || matches) { ignored = true; title = lastTitle; + break; } } lastTitle = title; - // Check for regex match + // Check for match GetProcessList(runningProcesses); for (ExecutableSceneSwitch& s : executableSwitches) { - // True if executable switch is running - bool running = (runningProcesses.indexOf(QRegularExpression(s.mExe)) != -1); + // True if executable switch is running (direct) + bool equals = runningProcesses.contains(s.mExe); + // True if executable switch is running (regex) + bool matches = (runningProcesses.indexOf(QRegularExpression(s.mExe)) != -1); // True if focus is disabled OR window in focus bool focus = (!s.mInFocus || isInFocus(s.mExe)); // True if current window is ignored AND executable switch matches last window bool ignore = (ignored && QString::fromStdString(title).contains(QRegularExpression(s.mExe))); - if (running && (focus || ignore)) + + if ((equals || matches) && (focus || ignore)) { match = true; scene = s.mScene; transition = s.mTransition; + break; } } diff --git a/src/linux/advanced-scene-switcher-nix.cpp b/src/linux/advanced-scene-switcher-nix.cpp index 420b7fbd..88028756 100644 --- a/src/linux/advanced-scene-switcher-nix.cpp +++ b/src/linux/advanced-scene-switcher-nix.cpp @@ -295,7 +295,12 @@ bool isInFocus(const QString &exeToCheck) string curWindow; GetCurrentWindowTitle(curWindow); - return QString::fromStdString(curWindow).contains(QRegularExpression(exeToCheck)); + // True if executable switch equals current window + bool equals = (exeToCheck.toStdString() == curWindow); + // True if executable switch matches current window + bool matches = QString::fromStdString(curWindow).contains(QRegularExpression(exeToCheck)); + + return (equals || matches); } diff --git a/src/window-title-switch.cpp b/src/window-title-switch.cpp index 899baca5..d92aac3e 100644 --- a/src/window-title-switch.cpp +++ b/src/window-title-switch.cpp @@ -234,28 +234,36 @@ void SwitcherData::checkWindowTitleSwitch(bool& match, OBSWeakSource& scene, OBS GetCurrentWindowTitle(title); for (auto& window : ignoreWindowsSwitches) { + // True if ignored switch equals title + bool equals = (title == window); // True if ignored switch matches title bool matches = QString::fromStdString(title).contains(QRegularExpression(window.c_str())); - if (matches) + + if (equals || matches) { title = lastTitle; + break; } } lastTitle = title; - // Check for regex match + // Check for match for (WindowSceneSwitch& s : windowSwitches) { + // True if window switch equals title + bool equals = (title == s.window); // 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) + + if ((equals || matches) && fullscreen) { match = true; scene = s.scene; transition = s.transition; + break; } }