diff --git a/SteamController/Controller.cs b/SteamController/Controller.cs index e8b2d14..b245cb8 100644 --- a/SteamController/Controller.cs +++ b/SteamController/Controller.cs @@ -212,47 +212,33 @@ namespace SteamController { context.Tick(); - var isDesktop = context.CurrentProfile?.IsDesktop ?? false; - var monitorOffIco = WindowsDarkMode.IsDarkModeEnabled ? Resources.monitor_off_white : Resources.monitor_off; - var monitorOnIco = WindowsDarkMode.IsDarkModeEnabled ? Resources.monitor_white : Resources.monitor; - var controllerOffIco = WindowsDarkMode.IsDarkModeEnabled ? - Resources.microsoft_xbox_controller_off_white : - Resources.microsoft_xbox_controller_off; - var controllerOnIco = WindowsDarkMode.IsDarkModeEnabled ? - Resources.microsoft_xbox_controller_white : - Resources.microsoft_xbox_controller; + var profile = context.CurrentProfile; if (!context.KeyboardMouseValid) { notifyIcon.Text = TitleWithVersion + ". Cannot send input."; - notifyIcon.Icon = Resources.microsoft_xbox_controller_off_red; + if (WindowsDarkMode.IsDarkModeEnabled) + notifyIcon.Icon = Resources.monitor_off_white; + else + notifyIcon.Icon = Resources.monitor_off; } - else if (!context.X360.Valid) + else if (!context.X360.Valid || !context.DS4.Valid) { notifyIcon.Text = TitleWithVersion + ". Missing ViGEm?"; notifyIcon.Icon = Resources.microsoft_xbox_controller_red; } - else if (context.Enabled) + else if (profile is not null) { - if (context.State.SteamUsesSteamInput) - { - notifyIcon.Icon = isDesktop ? monitorOffIco : controllerOffIco; - notifyIcon.Text = TitleWithVersion + ". Steam uses Steam Input"; - } - else - { - notifyIcon.Icon = isDesktop ? monitorOnIco : controllerOnIco; - notifyIcon.Text = TitleWithVersion; - } - - var profile = context.CurrentProfile; - if (profile is not null) - notifyIcon.Text = TitleWithVersion + ". Profile: " + profile.Name; + notifyIcon.Text = TitleWithVersion + ". Profile: " + profile.FullName; + notifyIcon.Icon = profile.Icon; } else { - notifyIcon.Icon = isDesktop ? monitorOffIco : controllerOffIco; notifyIcon.Text = TitleWithVersion + ". Disabled"; + if (WindowsDarkMode.IsDarkModeEnabled) + notifyIcon.Icon = Resources.microsoft_xbox_controller_off_white; + else + notifyIcon.Icon = Resources.microsoft_xbox_controller_off; } notifyIcon.Text += String.Format(". Updates: {0}/s", context.UpdatesPerSec); diff --git a/SteamController/Profiles/Dynamic/RoslynDynamicProfile.cs b/SteamController/Profiles/Dynamic/RoslynDynamicProfile.cs index 6fb182e..e6c8856 100644 --- a/SteamController/Profiles/Dynamic/RoslynDynamicProfile.cs +++ b/SteamController/Profiles/Dynamic/RoslynDynamicProfile.cs @@ -115,6 +115,19 @@ namespace SteamController.Profiles.Dynamic watchTimer.Start(); } + public override System.Drawing.Icon Icon + { + get + { + if (inherited is not null) + return inherited.Icon; + else if (CommonHelpers.WindowsDarkMode.IsDarkModeEnabled) + return Resources.microsoft_xbox_controller_white; + else + return Resources.microsoft_xbox_controller; + } + } + public override bool Selected(Context context) { return (this.compiledScript is not null) && (inherited?.Selected(context) ?? true); diff --git a/SteamController/Profiles/Predefined/DS4Profile.cs b/SteamController/Profiles/Predefined/DS4Profile.cs index 16b9772..fd63032 100644 --- a/SteamController/Profiles/Predefined/DS4Profile.cs +++ b/SteamController/Profiles/Predefined/DS4Profile.cs @@ -6,6 +6,17 @@ namespace SteamController.Profiles.Predefined { public class DS4Profile : Default.BackPanelShortcutsProfile { + public override System.Drawing.Icon Icon + { + get + { + if (CommonHelpers.WindowsDarkMode.IsDarkModeEnabled) + return Resources.microsoft_xbox_controller_white; + else + return Resources.microsoft_xbox_controller; + } + } + public override bool Selected(Context context) { return context.Enabled && context.DS4.Valid && context.KeyboardMouseValid && !context.State.SteamUsesSteamInput; diff --git a/SteamController/Profiles/Predefined/DesktopProfile.cs b/SteamController/Profiles/Predefined/DesktopProfile.cs index 19d7e35..b5af3f9 100644 --- a/SteamController/Profiles/Predefined/DesktopProfile.cs +++ b/SteamController/Profiles/Predefined/DesktopProfile.cs @@ -11,6 +11,17 @@ namespace SteamController.Profiles.Predefined IsDesktop = true; } + public override System.Drawing.Icon Icon + { + get + { + if (CommonHelpers.WindowsDarkMode.IsDarkModeEnabled) + return Resources.monitor_white; + else + return Resources.monitor; + } + } + internal override ProfilesSettings.BackPanelSettings BackPanelSettings { get { return ProfilesSettings.DesktopPanelSettings.Default; } diff --git a/SteamController/Profiles/Predefined/SteamProfile.cs b/SteamController/Profiles/Predefined/SteamProfile.cs index 44c45c5..eb86038 100644 --- a/SteamController/Profiles/Predefined/SteamProfile.cs +++ b/SteamController/Profiles/Predefined/SteamProfile.cs @@ -6,6 +6,22 @@ namespace SteamController.Profiles.Predefined { } + public override System.Drawing.Icon Icon + { + get + { + if (CommonHelpers.WindowsDarkMode.IsDarkModeEnabled) + return Resources.microsoft_xbox_controller_off_white; + else + return Resources.microsoft_xbox_controller_off; + } + } + + public override String FullName + { + get { return Name + " uses Steam Input"; } + } + public override bool Selected(Context context) { return context.Enabled && context.State.SteamUsesSteamInput && Settings.Default.SteamControllerConfigs != Settings.SteamControllerConfigsMode.Overwrite; diff --git a/SteamController/Profiles/Predefined/SteamWithShorcutsProfile.cs b/SteamController/Profiles/Predefined/SteamWithShorcutsProfile.cs index 85f0340..d6dfbb3 100644 --- a/SteamController/Profiles/Predefined/SteamWithShorcutsProfile.cs +++ b/SteamController/Profiles/Predefined/SteamWithShorcutsProfile.cs @@ -8,11 +8,27 @@ namespace SteamController.Profiles.Predefined { } + public override System.Drawing.Icon Icon + { + get + { + if (CommonHelpers.WindowsDarkMode.IsDarkModeEnabled) + return Resources.microsoft_xbox_controller_off_white; + else + return Resources.microsoft_xbox_controller_off; + } + } + public override bool Selected(Context context) { return context.Enabled && context.State.SteamUsesSteamInput; } + public override String FullName + { + get { return Name + " uses Steam Input"; } + } + public override Status Run(Context context) { // Steam does not use Lizard diff --git a/SteamController/Profiles/Predefined/X360Profile.cs b/SteamController/Profiles/Predefined/X360Profile.cs index e853492..021b038 100644 --- a/SteamController/Profiles/Predefined/X360Profile.cs +++ b/SteamController/Profiles/Predefined/X360Profile.cs @@ -11,11 +11,32 @@ namespace SteamController.Profiles.Predefined private bool TouchPadsEnabled { get; set; } = true; + public override System.Drawing.Icon Icon + { + get + { + if (CommonHelpers.WindowsDarkMode.IsDarkModeEnabled) + return Resources.microsoft_xbox_controller_white; + else + return Resources.microsoft_xbox_controller; + } + } + public override bool Selected(Context context) { return context.Enabled && context.X360.Valid && context.KeyboardMouseValid && !context.State.SteamUsesSteamInput; } + public override String FullName + { + get + { + if (EmulateTouchPads && TouchPadsEnabled) + return Name; + return Name + " without Touchpads"; + } + } + internal override ProfilesSettings.BackPanelSettings BackPanelSettings { get { return ProfilesSettings.X360BackPanelSettings.Default; } diff --git a/SteamController/Profiles/Profile.cs b/SteamController/Profiles/Profile.cs index 86b5861..3f8b18a 100644 --- a/SteamController/Profiles/Profile.cs +++ b/SteamController/Profiles/Profile.cs @@ -13,9 +13,11 @@ namespace SteamController.Profiles public event Action ErrorsChanged; public virtual String Name { get; set; } = ""; + public virtual String FullName { get; } = ""; public virtual bool Visible { get; set; } = true; public virtual bool IsDesktop { get; set; } public virtual string[]? Errors { get; set; } + public abstract System.Drawing.Icon Icon { get; } public abstract bool Selected(Context context);