From b45b38cf6af082a48de7225eb9c54cba24144097 Mon Sep 17 00:00:00 2001 From: Myned Date: Thu, 14 May 2020 18:49:35 -0400 Subject: [PATCH] Add ability to use regex for executable switching Previously, only exact matches to a window title would switch scenes --- src/executable-switch.cpp | 2 +- src/linux/advanced-scene-switcher-nix.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/executable-switch.cpp b/src/executable-switch.cpp index 009a41d4..cf9a4218 100644 --- a/src/executable-switch.cpp +++ b/src/executable-switch.cpp @@ -129,7 +129,7 @@ void SwitcherData::checkExeSwitch(bool& match, OBSWeakSource& scene, OBSWeakSour GetProcessList(runningProcesses); for (ExecutableSceneSwitch& s : executableSwitches) { - if (runningProcesses.contains(s.mExe)) + if (runningProcesses.indexOf(QRegularExpression(s.mExe)) != -1) { scene = s.mScene; transition = s.mTransition; diff --git a/src/linux/advanced-scene-switcher-nix.cpp b/src/linux/advanced-scene-switcher-nix.cpp index 66961225..420b7fbd 100644 --- a/src/linux/advanced-scene-switcher-nix.cpp +++ b/src/linux/advanced-scene-switcher-nix.cpp @@ -295,10 +295,7 @@ bool isInFocus(const QString &exeToCheck) string curWindow; GetCurrentWindowTitle(curWindow); - return (QString::compare( - QString::fromStdString(curWindow), - exeToCheck, - Qt::CaseInsensitive) == 0) ? true : false; + return QString::fromStdString(curWindow).contains(QRegularExpression(exeToCheck)); }