Skip to content

Commit 2e7a2af

Browse files
committed
fix(Steam::BigPicture): Improve detection of steam big picture
1 parent 0b0cd0c commit 2e7a2af

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

SoundSwitch/Framework/Profile/ProfileManager.cs

+20-8
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private bool RegisterTriggers(Profile profile, bool onInit = false)
100100
_profilesByUwpApp.Add(trigger.WindowName.ToLower(), (profile, trigger));
101101
return true;
102102
},
103-
() => true,
103+
() => true,
104104
() =>
105105
{
106106
_forcedProfile = profile;
@@ -310,12 +310,7 @@ private bool HandleSteamBigPicture(WindowMonitor.Event @event)
310310
return false;
311311
}
312312

313-
if (!@event.ProcessName.Contains("steam"))
314-
{
315-
return false;
316-
}
317-
318-
if (@event.WindowName != "SP" || @event.WindowClass != "SDL_app")
313+
if (!IsSteamBigPicture(@event))
319314
{
320315
return false;
321316
}
@@ -326,6 +321,23 @@ private bool HandleSteamBigPicture(WindowMonitor.Event @event)
326321
return true;
327322
}
328323

324+
private bool IsSteamBigPicture(WindowMonitor.Event @event)
325+
{
326+
if (!@event.ProcessName.ToLower().Contains("steam"))
327+
{
328+
return false;
329+
}
330+
331+
switch (@event.WindowName)
332+
{
333+
case "Steam" when @event.WindowClass == "CUIEngineWin32":
334+
case "SP" when @event.WindowClass == "SDL_app":
335+
return true;
336+
default:
337+
return false;
338+
}
339+
}
340+
329341
private DeviceInfo? CheckDeviceAvailable(DeviceInfo deviceInfo)
330342
{
331343
return deviceInfo.Type switch
@@ -521,7 +533,7 @@ private Result<string, VoidSuccess> ValidateProfile(Profile profile, bool init =
521533

522534
return null;
523535
},
524-
() => null,
536+
() => null,
525537
() => _forcedProfile != null ? SettingsStrings.profile_error_deviceChanged : null);
526538
if (error != null)
527539
{

0 commit comments

Comments
 (0)