steam-deck-tools/SteamController/Managers/SteamManager.cs
Kamil Trzciński ab5bc370df Introduce inheritable Profiles and Managers
- There's always a single Profile choosen
- There are many Managers changing settings
  depending on environment
- Improve and re-use mappings between profiles
- Introduce Steam Profile to be used when
  in Steam Big Picture or Steam Game
2022-11-26 10:19:50 +01:00

36 lines
1 KiB
C#

using System.Diagnostics;
using SteamController.Helpers;
namespace SteamController.Managers
{
public sealed class SteamManager : Manager
{
public override void Tick(Context context)
{
if (!Settings.Default.EnableSteamDetection)
{
context.SteamRunning = true;
context.SteamUsesController = false;
return;
}
var usesController = UsesController();
// if controller is used, disable due to Steam unless it is hidden
context.SteamRunning = usesController is not null;
context.SteamUsesController = usesController ?? false;
}
private bool? UsesController()
{
if (!SteamProcess.IsRunning.GetValueOrDefault(false))
return null;
return
SteamProcess.IsBigPictureMode.GetValueOrDefault(false) ||
SteamProcess.IsRunningGame.GetValueOrDefault(false) ||
SteamProcess.IsGamePadUI;
}
}
}