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

Add clipboard functionality #32

Open
Hyde46 opened this issue Sep 19, 2021 · 7 comments
Open

Add clipboard functionality #32

Hyde46 opened this issue Sep 19, 2021 · 7 comments
Labels
✨ enhancement New feature or request
Milestone

Comments

@Hyde46
Copy link
Owner

Hyde46 commented Sep 19, 2021

Add option to save commands to clipboard.
Useful if hoard list is not run with autocomplete as shell plugin

@Hyde46 Hyde46 added the ✨ enhancement New feature or request label Sep 19, 2021
@PurpleMyst
Copy link

I'm willing to work on this.

@PurpleMyst
Copy link

I'd love to get some more specification: Where do you want me to copy to the clipboard? In which subcommands?

@Hyde46
Copy link
Owner Author

Hyde46 commented Oct 18, 2021

Excited that you're interested in this issue!

I think this first needs some research on how to approach this properly.
The goal would be threefold:

  • The subcommand pick sends the string for the found command to the clipboard of the used operating system instead of just printing it to the console.

For the next two, its good to know that hoard can be installed as a shell plugin, which runs hoard list when called.
When running as a shell plugin, and selecting a command ( With the enter key ) in the GUI, your shell prompt will automatically be filled with the selected command. However, I have not found a way yet to replicate this functionality when the program is not ran as a shell plugin.
Thus:

  • When running hoard list as a shell plugin, copy a command into the clipboard by a (new) shortcut like <CTRL>y. See here for exemplary key handler events.
  • When running hoard list not as a shell plugin, support the previous way to send a command to the clipboard, but also when pressing enter do the same

The logic for the last two of actually sending a string to the clipboard can be handled after the hoard list subprocess is finished here.
Feel free to refactor this into a sperate file handling clipboard stuff

A final point on the clipboard support. hoard is expected to run on linux and mac. So, the clipboard handler should be capable to handle x11, wayland and whowever mac is doing it. This crate seems to lead the right way.
Also, this means the way of installing hoard has to be reconsidered, as a system level library will be a dependency. Either that, or we programatically check if the right libraries are installed and only support this feature if they are present.

Any thoughts on this? I'm open for any suggestion if you have some!

@PurpleMyst
Copy link

I think that looks good.

So, in short:

  • Support ^y to copy a command to the clipboard in hoard list
  • Also copy a command to the clipboard automatically if enter is pressed while we're not in shell-plugin mode.
  • hoard pick still prints to the console but also copies to the clipboard.

@Hyde46
Copy link
Owner Author

Hyde46 commented Oct 19, 2021

Sounds good!
Ill then take care to update the installers making sure the necessary dependencies are met for however you will will implement the clipboards

@PurpleMyst
Copy link

Sounds good! I'll work on this in the coming days. Progress might be a bit slow as I'm very busy.

@Hyde46
Copy link
Owner Author

Hyde46 commented Oct 19, 2021

Absolutely no worries, take the time you need for it !
Glad you're interested in contributing

@Hyde46 Hyde46 added this to the hoard 1.1.0 milestone Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants