Skip to content
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

Clipboard pane #681

Merged
merged 24 commits into from
Jul 6, 2024
Merged

Clipboard pane #681

merged 24 commits into from
Jul 6, 2024

Conversation

Julow
Copy link
Owner

@Julow Julow commented Jun 29, 2024

This adds the clipboard pane, which allows to save an arbitrary number of clipboards and to paste them later. The key can be disabled in settings.

Checking the "Recently copied text" checkbox will cause the keyboard to keep a temporary history of copied text. This history can only contain 3 elements which expire after 5 minutes. If this is unchecked, only the current system clipboard can be seen.

Ready for testing.

Julow added 18 commits June 29, 2024 22:53
Work in progress: It's not yet possible to paste from the pane.

The pane can be switched to and from and displays the strings recently
added to the clipboard.

ClipboardHistoryService listens for change to the system clipboard and
keep the history in memory.
This data is not persisted to the storage.

The maximum size limits the amount of user data stored in memory but
also gives a sense to the user that the history is not persisted and can
be forgotten as soon as the app stops.
Allow recent clips to be pinned. Pinned clips are put a different place
and are persistent.

The pane is split in two columns, the clipboard history and the pinned
clips.

Pinned clips are stored in a new preference file.

Improved pinning layout

clipboard: Remove history entry after pinning
Slightly improves privacy. Entries older than that are not useful in the
intended use case.
Put the recently copied text at the top and the pinned text at the
bottom.
This should remain intuitive as the recent history should stay small.
The feature is off by default for privacy reasons. The checkbox state is
persisted in the configuration.

The history is immediately cleared when it's disabled. The content of
the system clipboard is visible when the history is enabled.
The paste button send the content of the pinned clip to the editor the
same way as a string key.
Prevent accidentally deleting a saved clipboard.
To make it less ambiguous with the clipboard key icon.
@alotbsol555
Copy link
Contributor

hi, this looks good and I think it works as described, although I did not test it extensively.

some thoughts, hopefully impovements ;-)

  • add the delete button between the space bar and the enter button. like in the emoji view.
  • add an insert button to the recent entries. right now you can only save or delete them and you can only insert pinned entries.
  • use ths same icon for removing pinned and recent entries
  • the space bar has keys for switching layouts. what is their use? the emoji view does not have them.
  • the whole pane could be higher or have some handle on top top to change its height as needed. you only see a few lines but a single entry could have multiple lines.
  • maybe move pinned to top and the checkbox and recent entries below. but I guess this would depend on your usage.

@Julow
Copy link
Owner Author

Julow commented Jul 6, 2024

Thanks for your review :) That really helped me make the feature better.

The reason for putting the recent entries at the top is that the list of pinned entries is unbounded. Also, it's nice to quickly see whether the keyboard is collecting the history as some people might want to leave the checkbox disabled most of the time.
If it was at the bottom, the workflow for pinning the current clipboard would be to scroll the long list before finding it. The history is bounded in length (3 entries) and in time (5 minutes).
I'd prefer to keep it like that until I gathered more feedback.

I've made the pane a little taller but I like the idea of a handle at the top. This is definitely out of scope of this PR as it's a large task.

The keyboard switching keys have indeed no use and if it was fixed to work, it wouldn't be very intuitive, so I removed it.

I like the idea of an insert button but I'm a bit afraid to add a textbox dialog within the keyboard. Perhaps that would be solved by switching to a full activity but that seems a bit disrupting. Perhaps a new page in the settings. I'll leave that for later as well.

What do you think of it now ?

@alotbsol555
Copy link
Contributor

great, I think this looks really better now!

I like the idea of an insert button but I'm a bit afraid to add a textbox dialog within the keyboard. Perhaps that would be solved by switching to a full activity but that seems a bit disrupting. Perhaps a new page in the settings. I'll leave that for later as well.

I'm afraid this was a misunderstanding, because I wrote "insert" instead of "paste"!? with my second point, I just wanted to suggest adding the paste button to the recently added clipboard entries (the document icon with the arrow, which pastes the pinned entries). this button could be added to the recent entries, which are not yet pinned. You should be able to paste these entries as well, don't you think?

@alotbsol555
Copy link
Contributor

if you want to keep it as simple as possible, you might even remove the delete button for the recent entries. they disappear anyway after 5 minutes, or you can uncheck the checkbox to remove them completely.
you would end up with 2 icons everywhere: paste/pin for recent and paste/delete for pinned entries.

@Julow
Copy link
Owner Author

Julow commented Jul 6, 2024

That makes total sense! The remove button had a hidden feature, which is to clear the system clipboard if the current system clipboard is removed from the history. That was not very intuitive and I think would be better as a dedicated button.

Thanks again for your help ! I'll merge this now and do incremental improvements over time.

@Julow Julow merged commit bf3b9c3 into master Jul 6, 2024
8 checks passed
@Julow Julow added this to the 1.29.0 milestone Jul 6, 2024
@Julow Julow mentioned this pull request Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants