mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-06 14:53:48 +00:00
Maybe will show notification on controller changed
This commit is contained in:
parent
17a71dc110
commit
b977003efa
6 changed files with 36 additions and 10 deletions
|
|
@ -26,6 +26,8 @@ namespace SteamController
|
|||
public bool SteamRunning { get; set; } = false;
|
||||
public bool SteamUsesController { get; set; } = false;
|
||||
|
||||
public event Action<Profiles.Profile> ProfileChanged;
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get { return RequestEnable; }
|
||||
|
|
@ -55,6 +57,8 @@ namespace SteamController
|
|||
X360 = new Devices.Xbox360Controller();
|
||||
Keyboard = new Devices.KeyboardController();
|
||||
Mouse = new Devices.MouseController();
|
||||
|
||||
ProfileChanged += (_) => X360.Beep();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
@ -141,7 +145,9 @@ namespace SteamController
|
|||
list.Remove(profile);
|
||||
list.Insert(0, profile);
|
||||
RequestDesktopMode = profile.IsDesktop;
|
||||
Beep();
|
||||
|
||||
if (profile.Selected(this))
|
||||
ProfileChanged(profile);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -163,16 +169,24 @@ namespace SteamController
|
|||
|
||||
list.Remove(profile);
|
||||
list.Insert(0, profile);
|
||||
Beep();
|
||||
ProfileChanged(profile);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Beep()
|
||||
public void ToggleDesktopMode(bool? forceState = null)
|
||||
{
|
||||
X360.Beep();
|
||||
var oldProfile = GetCurrentProfile();
|
||||
if (forceState is null)
|
||||
RequestDesktopMode = !RequestDesktopMode;
|
||||
else
|
||||
RequestDesktopMode = forceState.Value;
|
||||
|
||||
var newProfile = GetCurrentProfile();
|
||||
if (oldProfile != newProfile && newProfile is not null)
|
||||
ProfileChanged(newProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using CommonHelpers;
|
||||
using ExternalHelpers;
|
||||
using SteamController.Helpers;
|
||||
using SteamController.Profiles;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -118,6 +117,18 @@ namespace SteamController
|
|||
contextStateUpdate.Enabled = true;
|
||||
contextStateUpdate.Tick += ContextStateUpdate_Tick;
|
||||
|
||||
context.ProfileChanged += (profile) =>
|
||||
{
|
||||
#if false
|
||||
notifyIcon.ShowBalloonTip(
|
||||
1000,
|
||||
TitleWithVersion,
|
||||
String.Format("Selected profile: {0}", profile.Name),
|
||||
ToolTipIcon.Info
|
||||
);
|
||||
#endif
|
||||
};
|
||||
|
||||
stopwatch.Start();
|
||||
|
||||
contextThread = new Thread(ContextState_Update);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace SteamController.Managers
|
|||
if (!activated)
|
||||
{
|
||||
activated = true;
|
||||
context.RequestDesktopMode = false;
|
||||
context.ToggleDesktopMode(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -39,7 +39,7 @@ namespace SteamController.Managers
|
|||
if (activated)
|
||||
{
|
||||
activated = false;
|
||||
context.RequestDesktopMode = true;
|
||||
context.ToggleDesktopMode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ namespace SteamController.Profiles
|
|||
{
|
||||
if (!c.SelectNext())
|
||||
{
|
||||
c.RequestDesktopMode = !c.RequestDesktopMode;
|
||||
c.ToggleDesktopMode();
|
||||
}
|
||||
return Status.Done;
|
||||
}
|
||||
else if (c.Steam.BtnOptions.HoldNext(HoldToSwitchDesktop, ShortcutConsumed, "SwitchToDesktop"))
|
||||
{
|
||||
c.RequestDesktopMode = !c.RequestDesktopMode;
|
||||
c.ToggleDesktopMode();
|
||||
return Status.Done;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue