diff --git a/Trdo/App.xaml.cs b/Trdo/App.xaml.cs
index a085ee6..0ca9768 100644
--- a/Trdo/App.xaml.cs
+++ b/Trdo/App.xaml.cs
@@ -156,18 +156,36 @@ private void InitializeTrayIcon()
private void TrayIcon_ContextMenu(TrayIcon sender, TrayIconEventArgs args)
{
- WindowPlacementService.CapturePointerAnchor();
- args.Flyout = CreateFlyout();
+ if (SettingsService.TrayClickBehavior == 1)
+ {
+ // Swapped: right click plays/pauses (fall back to flyout if no station selected)
+ if (_playerVm.CanPlay)
+ {
+ _playerVm.Toggle();
+ _ = UpdateTrayIconAsync();
+ return;
+ }
+ }
+
+ // Default: right click opens flyout; also fallback when no station is available
+ ShowFlyout(args);
}
private void TrayIcon_Selected(TrayIcon sender, TrayIconEventArgs args)
{
+ if (SettingsService.TrayClickBehavior == 1)
+ {
+ // Swapped: left click opens flyout
+ ShowFlyout(args);
+ return;
+ }
+
+ // Default: left click plays/pauses
// Check if we can play (have stations available and one selected)
if (!_playerVm.CanPlay)
{
// No stations available, show the flyout to encourage user to add a station
- WindowPlacementService.CapturePointerAnchor();
- args.Flyout = CreateFlyout();
+ ShowFlyout(args);
return;
}
@@ -176,6 +194,12 @@ private void TrayIcon_Selected(TrayIcon sender, TrayIconEventArgs args)
_ = UpdateTrayIconAsync();
}
+ private void ShowFlyout(TrayIconEventArgs args)
+ {
+ WindowPlacementService.CapturePointerAnchor();
+ args.Flyout = CreateFlyout();
+ }
+
private Flyout CreateFlyout()
{
Flyout flyout = new()
diff --git a/Trdo/Pages/SettingsPage.xaml b/Trdo/Pages/SettingsPage.xaml
index 45101f3..5326a09 100644
--- a/Trdo/Pages/SettingsPage.xaml
+++ b/Trdo/Pages/SettingsPage.xaml
@@ -10,6 +10,35 @@
+
+
+
+
+
@@ -22,389 +51,359 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+ VerticalAlignment="Center"
+ Orientation="Horizontal"
+ Spacing="2">
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
diff --git a/Trdo/Services/SettingsService.cs b/Trdo/Services/SettingsService.cs
index c676d77..a5f14cc 100644
--- a/Trdo/Services/SettingsService.cs
+++ b/Trdo/Services/SettingsService.cs
@@ -15,6 +15,7 @@ public static class SettingsService
private const string IsDiscogsEnabledKey = "IsDiscogsEnabled";
private const string IsAppleMusicEnabledKey = "IsAppleMusicEnabled";
private const string IsYouTubeMusicEnabledKey = "IsYouTubeMusicEnabled";
+ private const string TrayClickBehaviorKey = "TrayClickBehavior";
public static event EventHandler? MusicSearchServicesChanged;
@@ -136,6 +137,49 @@ public static bool IsYouTubeMusicEnabled
set => SetBoolSetting(IsYouTubeMusicEnabledKey, value);
}
+ ///
+ /// Gets or sets the tray icon click behavior.
+ /// 0 = left click plays/pauses, right click opens flyout (default).
+ /// 1 = left click opens flyout, right click plays/pauses.
+ ///
+ public static int TrayClickBehavior
+ {
+ get
+ {
+ try
+ {
+ if (ApplicationData.Current.LocalSettings.Values.TryGetValue(TrayClickBehaviorKey, out object? value))
+ {
+ return value switch
+ {
+ int i => i,
+ string s when int.TryParse(s, out int i2) => i2,
+ _ => 0
+ };
+ }
+ return 0;
+ }
+ catch
+ {
+ return 0;
+ }
+ }
+ set
+ {
+ try
+ {
+ // Only valid values are 0 (default) and 1 (swapped)
+ if (value < 0 || value > 1)
+ value = 0;
+ ApplicationData.Current.LocalSettings.Values[TrayClickBehaviorKey] = value;
+ }
+ catch
+ {
+ // Silently fail if unable to save
+ }
+ }
+ }
+
private static bool GetBoolSetting(string key, bool defaultValue)
{
try
diff --git a/Trdo/ViewModels/SettingsViewModel.cs b/Trdo/ViewModels/SettingsViewModel.cs
index 71cb010..4eecf9e 100644
--- a/Trdo/ViewModels/SettingsViewModel.cs
+++ b/Trdo/ViewModels/SettingsViewModel.cs
@@ -241,6 +241,22 @@ public string YouTubeMusicToggleText
}
}
+ ///
+ /// Gets or sets the tray icon click behavior.
+ /// 0 = left click plays/pauses, right click opens flyout (default).
+ /// 1 = left click opens flyout, right click plays/pauses.
+ ///
+ public int TrayClickBehavior
+ {
+ get => SettingsService.TrayClickBehavior;
+ set
+ {
+ if (value == SettingsService.TrayClickBehavior) return;
+ SettingsService.TrayClickBehavior = value;
+ OnPropertyChanged();
+ }
+ }
+
public bool IsWatchdogEnabled
{
get => _playerViewModel.WatchdogEnabled;