Skip to content

enhance: double tap stash to apply #1546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/ViewModels/StashesPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ public ContextMenu MakeContextMenu(Models.Stash stash)
apply.Icon = App.CreateMenuIcon("Icons.CheckCircled");
apply.Click += (_, ev) =>
{
if (_repo.CanCreatePopup())
_repo.ShowPopup(new ApplyStash(_repo, stash));

Apply(stash);
ev.Handled = true;
};

Expand All @@ -158,9 +156,7 @@ public ContextMenu MakeContextMenu(Models.Stash stash)
drop.Icon = App.CreateMenuIcon("Icons.Clear");
drop.Click += (_, ev) =>
{
if (_repo.CanCreatePopup())
_repo.ShowPopup(new DropStash(_repo, stash));

Drop(stash);
ev.Handled = true;
};

Expand Down Expand Up @@ -307,6 +303,12 @@ public void ClearSearchFilter()
SearchFilter = string.Empty;
}

public void Apply(Models.Stash stash)
{
if (stash != null && _repo.CanCreatePopup())
_repo.ShowPopup(new ApplyStash(_repo, stash));
}

public void Drop(Models.Stash stash)
{
if (stash != null && _repo.CanCreatePopup())
Expand Down
1 change: 1 addition & 0 deletions src/Views/StashesPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
ItemsSource="{Binding VisibleStashes}"
SelectedItem="{Binding SelectedStash, Mode=TwoWay}"
SelectionMode="Single"
DoubleTapped="OnStashListDoubleTapped"
KeyDown="OnStashListKeyDown"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto">
Expand Down
9 changes: 9 additions & 0 deletions src/Views/StashesPage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ private void OnMainLayoutSizeChanged(object sender, SizeChangedEventArgs e)
layout.StashesLeftWidth = new GridLength(maxLeft, GridUnitType.Pixel);
}

private void OnStashListDoubleTapped(object _, TappedEventArgs e)
{
if (DataContext is not ViewModels.StashesPage vm)
return;

vm.Apply(vm.SelectedStash);
e.Handled = true;
}

private void OnStashListKeyDown(object sender, KeyEventArgs e)
{
if (e.Key is not (Key.Delete or Key.Back))
Expand Down