Skip to content

Commit

Permalink
fix(Steam::BigPicture): Improve detection of steam big picture
Browse files Browse the repository at this point in the history
  • Loading branch information
Belphemur committed Jan 24, 2023
1 parent 0b0cd0c commit 2e7a2af
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions SoundSwitch/Framework/Profile/ProfileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private bool RegisterTriggers(Profile profile, bool onInit = false)
_profilesByUwpApp.Add(trigger.WindowName.ToLower(), (profile, trigger));
return true;
},
() => true,
() => true,
() =>
{
_forcedProfile = profile;
Expand Down Expand Up @@ -310,12 +310,7 @@ private bool HandleSteamBigPicture(WindowMonitor.Event @event)
return false;
}

if (!@event.ProcessName.Contains("steam"))
{
return false;
}

if (@event.WindowName != "SP" || @event.WindowClass != "SDL_app")
if (!IsSteamBigPicture(@event))
{
return false;
}
Expand All @@ -326,6 +321,23 @@ private bool HandleSteamBigPicture(WindowMonitor.Event @event)
return true;
}

private bool IsSteamBigPicture(WindowMonitor.Event @event)
{
if (!@event.ProcessName.ToLower().Contains("steam"))
{
return false;
}

switch (@event.WindowName)
{
case "Steam" when @event.WindowClass == "CUIEngineWin32":
case "SP" when @event.WindowClass == "SDL_app":
return true;
default:
return false;
}
}

private DeviceInfo? CheckDeviceAvailable(DeviceInfo deviceInfo)
{
return deviceInfo.Type switch
Expand Down Expand Up @@ -521,7 +533,7 @@ private Result<string, VoidSuccess> ValidateProfile(Profile profile, bool init =

return null;
},
() => null,
() => null,
() => _forcedProfile != null ? SettingsStrings.profile_error_deviceChanged : null);
if (error != null)
{
Expand Down

0 comments on commit 2e7a2af

Please sign in to comment.