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

Make clipboard support optional, with shell command escape hatch #121

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bew
Copy link

@bew bew commented May 19, 2023

Supersedes #110
Closes #84
Closes #119

This PR uses PR #110 to move the clipboard detection to a crate feature so it can be fully disabled, but it doesn't completely remove the copy actions.
Can be built using: cargo build --no-default-features

This PR also adds a command line option --clipboard-cmd CMD to be able to set an arbitrary shell command to use for copy actions as I requested in #119.


I tested this with the following commands:

$ ./target/debug/jless --clipboard-cmd 'cat > /tmp/clipboard' /path/to/a/file.json

In this case copy actions will send the copy target as input to cat > /tmp/clipboard.

And:

$ ./target/debug/jless /path/to/a/file.json

In this case copy actions will be disabled, with the error message:
Unable to access clipboard: No clipboard support, use --clipboard-cmd to set one

@bew bew force-pushed the optional-clip-via-shell-cmd branch from 798ca9f to 343e42f Compare May 19, 2023 18:51
@bew bew force-pushed the optional-clip-via-shell-cmd branch from 343e42f to 47e8277 Compare July 17, 2023 08:26
@bew
Copy link
Author

bew commented Jul 17, 2023

FYI I rebased this PR on latest main after 0.9.0 release, taking into account the new 'print' commands

@dufferzafar
Copy link

dufferzafar commented Jul 19, 2023

I used to use @gperry's patch from #110 locally. Now that main was updated to 0.9.0 I just did a pull & rebase over that branch. Came here to open a fresh PR and found @bew has already beaten me to it 🥇

@PaulJuliusMartinez Do you have any thoughts on this? Since the codebase already treats clipboard as a "feature", making it completely optional is the next logical step IMO. I disable clipboard simply because I can't get xcb library to link properly.

Having @bew's implementation is a bonus, since this works in tmux:

tmux set -g set-clipboard on

jless --clipboard-cmd 'tmux load-buffer -w -' filename.json

@bew bew changed the title Make clipboard optional, with shell command escape hatch Make clipboard deps optional, with shell command escape hatch May 22, 2024
@bew bew changed the title Make clipboard deps optional, with shell command escape hatch Make clipboard support optional, with shell command escape hatch May 22, 2024
@cjk
Copy link

cjk commented Jul 9, 2024

Too bad this has gone unnoticed for so long. Seems like jless is not really developed further anymore. Can only suggest others to take a look at fx which is similar but also has non-interactive filtering and clipboard-functionality just works (under Wayland, as well)

aswild pushed a commit to aswild/jless that referenced this pull request Jul 18, 2024
@farzadmf
Copy link

Thank you @cjk ; it's funny how sometimes we just bang our head against the wall!

I also have had a feeling that jless is no longer actively developed, and I knew about fx (and have it installed), but it didn't cross my mind to try it, and it "just works"!

Thank for reminding me 🙌

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.

Allow to copy path to element to arbitrary clipboard tool Make clipboard a feature
4 participants