SUPERCILEX / gnome-clipboard-history

Gnome Clipboard History is a clipboard manager Gnome extension that saves what you've copied into an easily accessible, searchable history panel.
https://extensions.gnome.org/extension/4839/clipboard-history/
MIT License
471 stars 46 forks source link

Confirmation dialog for deleting items #109

Open elliotwutingfeng opened 2 years ago

elliotwutingfeng commented 2 years ago

Problem description

When deleting non-favorited items, sometimes misclicks can cause favorited items to be accidentally deleted. Or misclicks can cause the wrong item to be deleted.

Potential solutions/workarounds

Workaround

User should be more careful when deleting items (but that's not really a solution :disappointed:)

Solution

Implement a confirmation dialog like Are you sure you want to delete this item? (or any better phrasing) when user clicks on trash icon to delete item.

Best is to allow users to enable/disable delete confirmation dialogs for either favorited items, non-favorited items, or both at the same time, via the extension preferences menu.

Additional context

nil

SUPERCILEX commented 2 years ago

In general, I kind of hate confirmation dialogs: they're the poor man's undo button. I'm wondering if we can instead use notifications as snackbars and provide an undo button in there. My main concern is that it'll be notification spam.

elliotwutingfeng commented 2 years ago

Sometimes I want to delete some recently copied entries when private mode happens to be toggled off.

For me the main issue is accidentally deleting the bottom-most favorite entry, when trying to delete the top-most non-favorite entry, which can happen due to cumulative layout shift. I am not too concerned about accidentally deleting non-favorite entries.

Instead of having an "undo" mechanism, an alternate approach is to allow the user to show/hide the favorite entries with a toggle button. Or maybe a "recycle-bin" for deleted favorite entries?

SUPERCILEX commented 2 years ago

That makes sense. Presumably you don't always make this mistake, so having a dialog would be annoying most of the time, hence undo.

A recycle bin is just undo with extra steps. :) (For the case where you may want to undo at a significantly later point in time.)

Given your use case, I think a good strat would be to only provide undo notifications for favorites and clearing the entire history. I don't think that'll be spammy.

If you'd like to give this a go in the PR, I can offer guidance.

elliotwutingfeng commented 2 years ago

Sure I'd give it a go. I can only work on this from the middle of next month onwards.

SUPERCILEX commented 2 years ago

Sounds good.