pvolok / mprocs

Run multiple commands in parallel
MIT License
1.48k stars 49 forks source link

[Feature Request] Select and copy text #47

Closed arifd closed 2 years ago

arifd commented 2 years ago

Hey,

so happy to report that we've now started using mprocs, after the scroll wheel update which is great. thank you!

Links are clickable which is great, but would it be possible to be able to select and copy text from the terminal, like you can otherwise? (Also change the pointer to the text icon)

pvolok commented 2 years ago

Hi. Thank you, happy to hear that mprocs is working for you.

This feature certainly should be included into mprocs. I'm thinking to implement it similar to tmux copy mode.

What do you mean by "Also change the pointer to the text icon"?

Alex141642 commented 2 years ago

I use mprocs at work, and this is the only feature that is missing to me!

Alex141642 commented 2 years ago

Hey @pvolok ! Thanks for the new version! I tried the copy function, but it seems that binding key 'c' doesn't copy the selected text..

I was able to select text with my mouse, pressing key 'c' and try to paste it. Is there something i'm missing? The command i tried: mprocs 'ls -la'

pvolok commented 2 years ago

@Alex141642 Which terminal are you using? And are you using tmux or screen? The first implementation is using OSC 52 terminal escape sequence, which might be disabled or not supported by terminal app or multiplexer.

For tmux it is disabled by default: https://github.com/pvolok/mprocs#copying-doesnt-work-in-tmux

I will probably have to add other ways to set clipboard content.

Alex141642 commented 2 years ago

I'm using Terminator/Konsole with Fish !

hartmut-mariadb commented 2 years ago

Not being able to mark text for copy by dragging with left mouse button pressed, or to paste text marked or copied elsewhere by pressing the middle mouse button, unfortunately makes this a show stopper for Linux terminal users.

Tried in Terminator and in good old xterm.

Too bad as this is otherwise a tool that would seem to otherwise be a tool perfectly fitting my "manage vagrant VM groups" needs ... :(

Alex141642 commented 2 years ago

It is actually very good!

hartmut-mariadb commented 2 years ago

It would be very good if it weren't for this show stopper. What's it good for to be able to switch between different tools output when not being able to seamlessly copy and paste?

Or are you telling me that it's good that this is not possible?

pvolok commented 2 years ago

@hartmut-mariadb Selecting with mouse works. The problem is that not all terminals support copying via terminal escape codes. But I plan to add copying with other means for those terminals.

hartmut-mariadb commented 2 years ago

Selecting with the mouse does not work for me, I so far tried terminator, xfce4-terminal and good old xterm

Pasting a selection from another terminal with the middle mouse button works in xfce4-terminal, does not work in good old xterm, and when using terminator it turned out that a double-middle-click works.

pvolok commented 2 years ago

I just released mprocs 0.6.3 with a more robust copy implementation. I hope it works for everyone. I will close this issue, please open new issues if you face any problems with the new implementation.

arifd commented 2 years ago

Hi @pvolok, this looks great! But unfortunately, both me and my colleague are unable to copy. there is nothing in the clipboard.

me: Ubuntu 21.04 colleague: Debian GNU/Linux 11 (bullseye)

pvolok commented 2 years ago

@arifd On Linux we check which copy tool is available from this list:

If none of those tools exist in $PATH, then a terminal escape sequence OSC52 is issued (which hopefully will be picked up by your terminal app).

Can you please provide the following:

arifd commented 2 years ago

Correct, none of the above commands are installed. In my case:

pvolok commented 2 years ago

@arifd To copy text on x11 mprocs tries to use xsel or xclip commands. I guess that you don't have either of those available. Can you try to install either of those from your distro repos and check if mprocs can copy text?

arifd commented 2 years ago

Yup installing xsel solved it. thanks.

Perhaps this package https://crates.io/crates/clipboard/0.5.0 which also uses clipboard-win would give you cross compatibility out of the box?

pvolok commented 2 years ago

@arifd I used that crate and tried others similar. But they all segfault on linux without x11. So for now I just copied the way neovim does copying. I think it's possible to use x11-clipboard crate to copy directly through x11 api, but I'd prefer not to deal with it right now.