diff --git a/src/EbbesMemeClipboard/Models/AppSettings.cs b/src/EbbesMemeClipboard/Models/AppSettings.cs
index 4c39160..35733e1 100644
--- a/src/EbbesMemeClipboard/Models/AppSettings.cs
+++ b/src/EbbesMemeClipboard/Models/AppSettings.cs
@@ -20,4 +20,13 @@ public sealed class AppSettings
/// costs noticeably more CPU and memory than showing static first frames.
///
public bool PlayGifPreviews { get; set; }
+
+ ///
+ /// Which tab the picker reopens on. Persisted so the choice survives an app restart, not
+ /// just a hide/show. Defaults to the favourites view, since that is where the memes you
+ /// actually reach for most often live.
+ ///
+ public MemeSource LastSource { get; set; } = MemeSource.Local;
+
+ public bool LastShowingFavorites { get; set; } = true;
}
diff --git a/src/EbbesMemeClipboard/ViewModels/PickerViewModel.cs b/src/EbbesMemeClipboard/ViewModels/PickerViewModel.cs
index de72872..1b53839 100644
--- a/src/EbbesMemeClipboard/ViewModels/PickerViewModel.cs
+++ b/src/EbbesMemeClipboard/ViewModels/PickerViewModel.cs
@@ -99,7 +99,16 @@ public partial class PickerViewModel : ObservableObject
_providers = providers.ToList();
Items.CollectionChanged += OnItemsChanged;
- RefreshLocalItems();
+
+ // Restore the tab the picker was last left on. Assigned to the backing fields directly
+ // so restoring doesn't count as a user change and immediately re-save.
+ _activeSource = _settings.Current.LastSource;
+ _showingFavorites = _settings.Current.LastShowingFavorites;
+
+ // Seed the grid for the restored view. Remote sources are skipped here because that
+ // needs an async call - OnShown covers it when the window is actually opened.
+ if (_showingFavorites) RefreshFavoriteItems();
+ else if (IsLocalSource) RefreshLocalItems();
}
private void OnItemsChanged(object? sender, NotifyCollectionChangedEventArgs e) =>
@@ -116,6 +125,7 @@ public partial class PickerViewModel : ObservableObject
OnPropertyChanged(nameof(EmptyStateText));
OnPropertyChanged(nameof(ShowEmptyState));
SearchText = string.Empty;
+ PersistViewState();
_ = RefreshAsync();
}
@@ -127,11 +137,19 @@ public partial class PickerViewModel : ObservableObject
OnPropertyChanged(nameof(CanImport));
OnPropertyChanged(nameof(ShowEmptyState));
SearchText = string.Empty;
+ PersistViewState();
// Setting SearchText above only triggers a refresh if the value actually changed, so
// refresh explicitly here to cover switching tabs with an already-empty box.
_ = RefreshAsync();
}
+ private void PersistViewState()
+ {
+ _settings.Current.LastSource = ActiveSource;
+ _settings.Current.LastShowingFavorites = ShowingFavorites;
+ _ = _settings.SaveAsync();
+ }
+
[RelayCommand]
private void SelectSource(MemeSource source) => ActiveSource = source;
diff --git a/src/EbbesMemeClipboard/Views/PickerWindow.xaml b/src/EbbesMemeClipboard/Views/PickerWindow.xaml
index aa1f7ac..1a3641b 100644
--- a/src/EbbesMemeClipboard/Views/PickerWindow.xaml
+++ b/src/EbbesMemeClipboard/Views/PickerWindow.xaml
@@ -202,7 +202,8 @@
ToolTip="Add memes"/>
-