Add temp vars for window position and size

This commit is contained in:
WarmUpTill
2026-05-17 20:01:04 +02:00
parent 20c276f4ea
commit ee1d0136d9
5 changed files with 101 additions and 0 deletions

View File

@@ -107,6 +107,15 @@ void MacroConditionWindow::SetVariableValueBasedOnMatch(
const std::string &matchWindow)
{
SetTempVarValue("window", matchWindow);
const auto geo = GetWindowGeometry(matchWindow);
if (geo) {
SetTempVarValue("windowX", std::to_string(geo->x));
SetTempVarValue("windowY", std::to_string(geo->y));
SetTempVarValue("windowWidth", std::to_string(geo->width));
SetTempVarValue("windowHeight", std::to_string(geo->height));
}
#ifdef _WIN32
SetTempVarValue("windowClass",
GetWindowClassByWindowTitle(matchWindow));
@@ -201,6 +210,26 @@ void MacroConditionWindow::SetupTempVars()
obs_module_text("AdvSceneSwitcher.tempVar.window.window"),
obs_module_text(
"AdvSceneSwitcher.tempVar.window.window.description"));
AddTempvar(
"windowX",
obs_module_text("AdvSceneSwitcher.tempVar.window.windowX"),
obs_module_text(
"AdvSceneSwitcher.tempVar.window.windowX.description"));
AddTempvar(
"windowY",
obs_module_text("AdvSceneSwitcher.tempVar.window.windowY"),
obs_module_text(
"AdvSceneSwitcher.tempVar.window.windowY.description"));
AddTempvar(
"windowWidth",
obs_module_text("AdvSceneSwitcher.tempVar.window.windowWidth"),
obs_module_text(
"AdvSceneSwitcher.tempVar.window.windowWidth.description"));
AddTempvar(
"windowHeight",
obs_module_text("AdvSceneSwitcher.tempVar.window.windowHeight"),
obs_module_text(
"AdvSceneSwitcher.tempVar.window.windowHeight.description"));
#ifdef _WIN32
AddTempvar(
"windowClass",