Support -run-on-startup on command line

This commit is contained in:
Kamil Trzciński 2022-12-10 11:23:47 +01:00
parent 70492acd74
commit 4b66119d57
6 changed files with 18 additions and 0 deletions

View file

@ -28,6 +28,11 @@ namespace CommonHelpers
private const String GLOBAL_MUTEX_NAME = "Global\\SteamDeckToolsCommonHelpers";
private const int GLOBAL_DEFAULT_TIMEOUT = 5000;
public static bool WantsRunOnStartup
{
get { return Environment.GetCommandLineArgs().Contains("-run-on-startup"); }
}
public static bool UseKernelDrivers
{
get { return useKernelDrivers; }

View file

@ -20,6 +20,9 @@ namespace FanControl
Text += " v" + Application.ProductVersion.ToString();
Instance.Open(Text, true, "Global\\FanControlOnce");
if (Instance.WantsRunOnStartup)
startupManager.Startup = true;
fanControl = new FanController();
SharedData_Update();

View file

@ -31,6 +31,9 @@ namespace PerformanceOverlay
SharedData_Update();
Instance.Open(TitleWithVersion, true, "Global\\PerformanceOverlay");
if (Instance.WantsRunOnStartup)
startupManager.Startup = true;
showItem = new ToolStripMenuItem("&Show OSD");
showItem.Click += ShowItem_Click;
showItem.Checked = Settings.Default.ShowOSD;

View file

@ -41,6 +41,9 @@ namespace PowerControl
{
Instance.RunOnce(TitleWithVersion, "Global\\PowerControl");
if (Instance.WantsRunOnStartup)
startupManager.Startup = true;
var contextMenu = new System.Windows.Forms.ContextMenuStrip(components);
contextMenu.Opening += delegate (object? sender, CancelEventArgs e)

View file

@ -22,3 +22,4 @@
- Recreate X360 device on fatal failure (might happen after resume)
- DEBUG allows to keep X360 controller always connected
- Swap `STEAM+Menu` and `STEAM+Options`. It makes more sense to switch windows with STEAM+3 horizontal lines
- If application is run with `-run-on-startup` it will self-set to run on system start

View file

@ -42,6 +42,9 @@ namespace SteamController
Instance.RunOnce(TitleWithVersion, "Global\\SteamController");
if (Instance.WantsRunOnStartup)
startupManager.Startup = true;
var contextMenu = new ContextMenuStrip(components);
var enabledItem = new ToolStripMenuItem("&Enabled");