diff --git a/HandheldCompanion/App.config b/HandheldCompanion/App.config
index 2269c726b..62976d0ed 100644
--- a/HandheldCompanion/App.config
+++ b/HandheldCompanion/App.config
@@ -278,6 +278,9 @@
False
+
+ True
+
\ No newline at end of file
diff --git a/HandheldCompanion/Controls/Hints/Hint_SteamNeptuneDesktop.cs b/HandheldCompanion/Controls/Hints/Hint_SteamNeptuneDesktop.cs
index a163d929c..10ea0ee38 100644
--- a/HandheldCompanion/Controls/Hints/Hint_SteamNeptuneDesktop.cs
+++ b/HandheldCompanion/Controls/Hints/Hint_SteamNeptuneDesktop.cs
@@ -12,6 +12,7 @@ public Hint_SteamNeptuneDesktop() : base()
{
PlatformManager.Steam.Updated += Steam_Updated;
PlatformManager.Initialized += PlatformManager_Initialized;
+ SettingsManager.SettingValueChanged += SettingsManager_SettingValueChanged;
// default state
this.HintActionButton.Visibility = Visibility.Visible;
@@ -24,7 +25,8 @@ public Hint_SteamNeptuneDesktop() : base()
}
private void Steam_Updated(PlatformStatus status)
- {
+ {
+ bool OverrideSteamProfileOnStart = SettingsManager.GetBoolean("OverrideSteamProfileOnStart");
bool DesktopProfileApplied = PlatformManager.Steam.HasDesktopProfileApplied();
// UI thread (async)
@@ -38,7 +40,24 @@ private void Steam_Updated(PlatformStatus status)
this.Visibility = Visibility.Collapsed;
break;
case PlatformStatus.Started:
- this.Visibility = DesktopProfileApplied ? Visibility.Visible : Visibility.Collapsed;
+
+ if (OverrideSteamProfileOnStart)
+ {
+ this.HintTitle.Text = Properties.Resources.Hint_SteamNeptuneDesktop;
+ this.HintDescription.Text = Properties.Resources.Hint_SteamNeptuneDesktopDesc;
+ this.HintReadMe.Text = Properties.Resources.Hint_SteamNeptuneReadme;
+
+ this.Visibility = DesktopProfileApplied ? Visibility.Visible : Visibility.Collapsed;
+ }
+ else
+ {
+ this.HintTitle.Text = Properties.Resources.Hint_SteamNeptuneDesktopOverridden;
+ this.HintDescription.Text = Properties.Resources.Hint_SteamNeptuneDesktopOverriddenDesc;
+ this.HintReadMe.Text = Properties.Resources.Hint_SteamNeptuneReadmeOverridden;
+
+ this.Visibility = !DesktopProfileApplied ? Visibility.Visible : Visibility.Collapsed;
+ }
+
break;
}
});
@@ -49,6 +68,16 @@ private void PlatformManager_Initialized()
Steam_Updated(PlatformManager.Steam.Status);
}
+ private void SettingsManager_SettingValueChanged(string name, object value)
+ {
+ switch (name)
+ {
+ case "OverrideSteamProfileOnStart":
+ Steam_Updated(PlatformManager.Steam.Status);
+ break;
+ }
+ }
+
protected override void HintActionButton_Click(object sender, RoutedEventArgs e)
{
Task.Run(async () =>
diff --git a/HandheldCompanion/Platforms/Steam.cs b/HandheldCompanion/Platforms/Steam.cs
index 2233f2b6c..390858d2c 100644
--- a/HandheldCompanion/Platforms/Steam.cs
+++ b/HandheldCompanion/Platforms/Steam.cs
@@ -78,16 +78,24 @@ public override bool Stop(bool kill = false)
{
ProcessManager.ProcessStarted -= ProcessManager_ProcessStarted;
- // restore files even if Steam is still running
- RestoreFiles();
+ if (HasDesktopProfileApplied())
+ {
+ // restore files even if Steam is still running
+ RestoreFiles();
+ }
return base.Stop();
}
protected override void Process_Exited(object? sender, EventArgs e)
{
- LogManager.LogDebug("Steam stopped, restoring files");
- RestoreFiles();
+ SettingsManager.SettingValueChanged -= SettingsManager_SettingValueChanged;
+
+ if (HasDesktopProfileApplied())
+ {
+ LogManager.LogDebug("Steam stopped, restoring files");
+ RestoreFiles();
+ }
}
public bool HasXboxDriversInstalled()
@@ -140,7 +148,14 @@ private async void ProcessManager_ProcessStarted(ProcessEx processEx, bool OnSta
if (!OnStartup && processEx.Executable == RunningName)
{
await Task.Delay(3000);
- ReplaceFiles();
+
+ // Overwrite files only if setting is enabled.
+ if (SettingsManager.GetBoolean("OverrideSteamProfileOnStart"))
+ {
+ ReplaceFiles();
+ }
+
+ SettingsManager.SettingValueChanged += SettingsManager_SettingValueChanged;
// hook into current process
if (Process is not null && !Process.HasExited)
@@ -148,6 +163,29 @@ private async void ProcessManager_ProcessStarted(ProcessEx processEx, bool OnSta
}
}
+ private void SettingsManager_SettingValueChanged(string name, object value)
+ {
+ switch (name)
+ {
+ case "OverrideSteamProfileOnStart":
+
+ if (Convert.ToBoolean(value))
+ {
+ if (HasDesktopProfileApplied())
+ {
+ // Steam profile applied, overwrite enabled
+ ReplaceFiles();
+ }
+ }
+ else if (!HasDesktopProfileApplied())
+ {
+ // Steam profile overwritten, overwrite disabled
+ RestoreFiles();
+ }
+ break;
+ }
+ }
+
public HashSet? GetControllerBlacklist()
{
try
diff --git a/HandheldCompanion/Properties/Resources.Designer.cs b/HandheldCompanion/Properties/Resources.Designer.cs
index 19407c330..85b360427 100644
--- a/HandheldCompanion/Properties/Resources.Designer.cs
+++ b/HandheldCompanion/Properties/Resources.Designer.cs
@@ -3743,6 +3743,24 @@ public static string Hint_SteamNeptuneDesktopDesc {
}
}
+ ///
+ /// Looks up a localized string similar to Steam Desktop Layout is overwritten.
+ ///
+ public static string Hint_SteamNeptuneDesktopOverridden {
+ get {
+ return ResourceManager.GetString("Hint_SteamNeptuneDesktopOverridden", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Steam Desktop Layout overwrite was disabled while Steam was running. Please restart Steam to apply changes.
+ ///
+ public static string Hint_SteamNeptuneDesktopOverriddenDesc {
+ get {
+ return ResourceManager.GetString("Hint_SteamNeptuneDesktopOverriddenDesc", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to You should restart Steam, so that Handheld Companion can automatically adjust Steam Desktop Layout and prevent double input.
///
@@ -3752,6 +3770,15 @@ public static string Hint_SteamNeptuneReadme {
}
}
+ ///
+ /// Looks up a localized string similar to You should restart Steam, so that Steam Desktop Layout can be reset to defaults.
+ ///
+ public static string Hint_SteamNeptuneReadmeOverridden {
+ get {
+ return ResourceManager.GetString("Hint_SteamNeptuneReadmeOverridden", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Steam Xbox Controller Enhanced Features Driver is installed.
///
@@ -8147,6 +8174,24 @@ public static string SettingsPage_OpenAppBackgroundDesc {
}
}
+ ///
+ /// Looks up a localized string similar to Override Steam profiles at startup.
+ ///
+ public static string SettingsPage_OverrideSteamProfileOnStart {
+ get {
+ return ResourceManager.GetString("SettingsPage_OverrideSteamProfileOnStart", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Default Steam desktop and chord input profiles will be swapped for empty ones on application start.
+ ///
+ public static string SettingsPage_OverrideSteamProfileOnStartDesc {
+ get {
+ return ResourceManager.GetString("SettingsPage_OverrideSteamProfileOnStartDesc", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Quicktools backdrop, none, mica, tabbed, acrylic.
///
diff --git a/HandheldCompanion/Properties/Resources.resx b/HandheldCompanion/Properties/Resources.resx
index 65e086a98..6eca297dd 100644
--- a/HandheldCompanion/Properties/Resources.resx
+++ b/HandheldCompanion/Properties/Resources.resx
@@ -3012,4 +3012,19 @@ Motion input toggle: press selected button(s) to switch motion state.
Sets the maximum charge level of the battery to 80%
+
+ Override Steam profiles at startup
+
+
+ Default Steam desktop and chord input profiles will be swapped for empty ones on application start
+
+
+ Steam Desktop Layout is overwritten
+
+
+ Steam is already running and Steam Desktop Layout is overwritten by Handheld Companion, but this setting was disabled by the user
+
+
+ You should restart Steam, so that Steam Desktop Layout can be reset to defaults
+
\ No newline at end of file
diff --git a/HandheldCompanion/Properties/Settings.Designer.cs b/HandheldCompanion/Properties/Settings.Designer.cs
index 426c698bf..f6cf74a42 100644
--- a/HandheldCompanion/Properties/Settings.Designer.cs
+++ b/HandheldCompanion/Properties/Settings.Designer.cs
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
@@ -11,13 +11,13 @@
namespace HandheldCompanion.Properties
{
-
-
+
+
[SettingsProvider(typeof(CustomSettingsProvider))]
internal sealed partial class Settings : ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
+
public static Settings Default
{
get
@@ -25,7 +25,7 @@ public static Settings Default
return defaultInstance;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
@@ -1103,7 +1103,7 @@ public int LegionControllerGyroIndex {
this["LegionControllerGyroIndex"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
@@ -1118,5 +1118,17 @@ public bool LegionBatteryChargeLimit
this["LegionBatteryChargeLimit"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool OverrideSteamProfileOnStart {
+ get {
+ return ((bool)(this["OverrideSteamProfileOnStart"]));
+ }
+ set {
+ this["OverrideSteamProfileOnStart"] = value;
+ }
+ }
}
}
diff --git a/HandheldCompanion/Properties/Settings.settings b/HandheldCompanion/Properties/Settings.settings
index 97b03d5e1..2ce453eb5 100644
--- a/HandheldCompanion/Properties/Settings.settings
+++ b/HandheldCompanion/Properties/Settings.settings
@@ -275,5 +275,8 @@
False
+
+ True
+
\ No newline at end of file
diff --git a/HandheldCompanion/Views/Pages/SettingsPage.xaml b/HandheldCompanion/Views/Pages/SettingsPage.xaml
index b543e80b0..0306da8ab 100644
--- a/HandheldCompanion/Views/Pages/SettingsPage.xaml
+++ b/HandheldCompanion/Views/Pages/SettingsPage.xaml
@@ -249,6 +249,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+