mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-03-06 13:03:52 +01:00
SteamController: Improve icon handling for Profiles
This commit is contained in:
parent
ce1435947c
commit
eed1453daf
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@ namespace SteamController.Profiles
|
|||
public event Action<string[]> 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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue