process-compose icon indicating copy to clipboard operation
process-compose copied to clipboard

Enable Copy and pasting from the tui

Open 0xmovses opened this issue 1 year ago • 1 comments

Feature Request

It would be great to be able to copy and paste from the tui

Use Case:

To easily share output

Proposed Change:

Who Benefits From The Change(s)?

Developers

Alternative Approaches

0xmovses avatar Oct 22 '24 22:10 0xmovses

Hi @0xmovses,

Are you using Wayland? If yes, please check https://github.com/F1bonacc1/process-compose/issues/116

I can probably solve it by requiring the users to install an additional dependency on their Wayland distro, which I wanted to avoid.

F1bonacc1 avatar Oct 26 '24 12:10 F1bonacc1

I'm on macOS using Kitty and am also unable to copy/paste from the tui log output. I can use select mode to select text but pressing cmd+c to copy does nothing. Is there a separate shortcut specific to process-compose or Kitty I should be using?

joefiorini avatar Nov 15 '24 16:11 joefiorini

Is there a separate shortcut specific to process-compose or Kitty I should be using?

Try Control + Shift + H and then select and copy

adrian-gierakowski avatar Nov 16 '24 13:11 adrian-gierakowski

Hi @joefiorini, I never personally tested it on macOS, but processs-compose should show you this hint when you enter selection more: image

Can you please confirm:

  1. that the hint is indeed shown
  2. that when you press Enter the selection is indeed copied

Thanks!

F1bonacc1 avatar Nov 23 '24 21:11 F1bonacc1

I'm on WSL using Windows Terminal and I have searched quite a while for a way to enter selection mode. Normally it's just clicking and dragging the mouse. I found that pressing Shift and dragging the mouse works. There is no hint shown that would indicate that process-compose is aware that it is now in selection mode.

When selecting multiple lines this way, the windows borders are also selected (and copy-pasted). It would be better to be able to just select the log text.

kaibr avatar Nov 29 '24 16:11 kaibr

Hi @kaibr,

Did you go into selection mode with Ctrl+S?

F1bonacc1 avatar Nov 30 '24 12:11 F1bonacc1

Actually, I'm not sure what "selection mode" is, whether that is a mode of the terminal or of process-compose, and whether either was in it. What I can say is that I was able to select, copy and paste text. In order to select text, I had to press Shift and drag the mouse. I did not press Ctrl-S at any point. Just now, I tested what pressing Ctrl-S does and it does not seem to do anything. In particular, it does not allow me to select text.

kaibr avatar Nov 30 '24 14:11 kaibr

Your terminal may have bound Ctrl-s to some other shortcut. You can try to change either your terminal or process-compose shortcut. https://f1bonacc1.github.io/process-compose/tui/#shortcuts-configuration

# $XDG_CONFIG_HOME/process-compose/shortcuts.yaml
shortcuts:
  log_select: # action name - don't edit
    shortcut: Ctrl-S # shortcut to be used

You should see the change after restarting process-compose: image

F1bonacc1 avatar Nov 30 '24 14:11 F1bonacc1

My terminal does not seem to bind Ctrl-S (Windows Terminal default bindings). However, I tried your suggestion and bound log_select to Ctrl-R, Ctrl-T, Ctrl-U, F1, F11, F12. None of that worked. (In particular, there was no change in the visible key bindings on screen.) To see whether process-compose was actually finding shortcuts.yaml, I bound quit to F3 (as in the docs). Then the change was visible -- however: the key F3 did not actually quit, it showed process info just as before. image

kaibr avatar Nov 30 '24 17:11 kaibr

I tried F11 and it didn't work because it is bound to Full Screen in my Konsole (KDE Terminal), then I tried Ctrl-U and it worked as expected: image

F3 behavior is expected since you must first unbind it from process_info to which it is bound by default.

F1bonacc1 avatar Nov 30 '24 17:11 F1bonacc1

I can probably solve it by requiring the users to install an additional dependency on their Wayland distro, which I wanted to avoid.

I would love that solution, and hopefully enabling copying on wayland. Honestly such a great tool that is currently pretty limiting to anyone with that WM.

smazurov avatar Aug 18 '25 00:08 smazurov

Hi @joefiorini, I never personally tested it on macOS, but processs-compose should show you this hint when you enter selection more: image

Can you please confirm:

  1. that the hint is indeed shown
  2. that when you press Enter the selection is indeed copied

Thanks!

I just tried this and got a go panic. I'm SSHed from my mac into a arch machine. My terminal is ghostty and the shell on the server is zsh.

goroutine 82 [running]:
github.com/rivo/tview.(*Application).Run.func1()
        github.com/rivo/[email protected]/application.go:319 +0x45
panic({0x1112440?, 0xc001388130?})
        runtime/panic.go:783 +0x132
github.com/f1bonacc1/glippy.start()
        github.com/f1bonacc1/[email protected]/glippy_linux.go:30 +0x33f
github.com/f1bonacc1/glippy.startOnce.func1()
        github.com/f1bonacc1/[email protected]/glippy.go:15 +0xf
sync.(*Once).doSlow(0xc0010f2380?, 0x1ad?)
        sync/once.go:78 +0xac
sync.(*Once).Do(...)
        sync/once.go:69
github.com/f1bonacc1/glippy.startOnce()
        github.com/f1bonacc1/[email protected]/glippy.go:14 +0x2c
github.com/f1bonacc1/glippy.Set({0xc0010f2380, 0x1ad})
        github.com/f1bonacc1/[email protected]/glippy.go:21 +0x1d
github.com/f1bonacc1/process-compose/src/tui.newPcView.(*pcView).createLogSelectionTextArea.func1(0xc001153d30?)
        github.com/f1bonacc1/process-compose/src/tui/log-operations.go:104 +0x65
github.com/rivo/tview.(*TextArea).InputHandler.(*Box).WrapInputHandler.func2(0xc0003eb508?, 0xc001388100)
        github.com/rivo/[email protected]/box.go:164 +0x37
github.com/rivo/tview.(*Grid).InputHandler.func1(0xc0004220e0, 0xc001388100)
        github.com/rivo/[email protected]/grid.go:664 +0x1af
github.com/rivo/tview.(*Grid).InputHandler.(*Box).WrapInputHandler.func2(0xc000139290?, 0xc001388100?)
        github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Pages).InputHandler.func1(0xc0004220e0, 0xc001388100)
        github.com/rivo/[email protected]/pages.go:334 +0xa2
github.com/rivo/tview.(*Pages).InputHandler.(*Box).WrapInputHandler.func2(0xc0001bf3b0?, 0xc001153e28?)
        github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Application).Run(0xc0004f84b0)
        github.com/rivo/[email protected]/application.go:441 +0x8da
github.com/f1bonacc1/process-compose/src/tui.RunTUIAsync.func1()
        github.com/f1bonacc1/process-compose/src/tui/view.go:604 +0x25
created by github.com/f1bonacc1/process-compose/src/tui.RunTUIAsync in goroutine 1
        github.com/f1bonacc1/process-compose/src/tui/view.go:603 +0x31

comath avatar Oct 17 '25 16:10 comath

same issue, inside tmux

Hi @joefiorini, I never personally tested it on macOS, but processs-compose should show you this hint when you enter selection more: image Can you please confirm:

  1. that the hint is indeed shown
  2. that when you press Enter the selection is indeed copied

Thanks!

I just tried this and got a go panic. I'm SSHed from my mac into a arch machine. My terminal is ghostty and the shell on the server is zsh.

goroutine 82 [running]:
github.com/rivo/tview.(*Application).Run.func1()
        github.com/rivo/[email protected]/application.go:319 +0x45
panic({0x1112440?, 0xc001388130?})
        runtime/panic.go:783 +0x132
github.com/f1bonacc1/glippy.start()
        github.com/f1bonacc1/[email protected]/glippy_linux.go:30 +0x33f
github.com/f1bonacc1/glippy.startOnce.func1()
        github.com/f1bonacc1/[email protected]/glippy.go:15 +0xf
sync.(*Once).doSlow(0xc0010f2380?, 0x1ad?)
        sync/once.go:78 +0xac
sync.(*Once).Do(...)
        sync/once.go:69
github.com/f1bonacc1/glippy.startOnce()
        github.com/f1bonacc1/[email protected]/glippy.go:14 +0x2c
github.com/f1bonacc1/glippy.Set({0xc0010f2380, 0x1ad})
        github.com/f1bonacc1/[email protected]/glippy.go:21 +0x1d
github.com/f1bonacc1/process-compose/src/tui.newPcView.(*pcView).createLogSelectionTextArea.func1(0xc001153d30?)
        github.com/f1bonacc1/process-compose/src/tui/log-operations.go:104 +0x65
github.com/rivo/tview.(*TextArea).InputHandler.(*Box).WrapInputHandler.func2(0xc0003eb508?, 0xc001388100)
        github.com/rivo/[email protected]/box.go:164 +0x37
github.com/rivo/tview.(*Grid).InputHandler.func1(0xc0004220e0, 0xc001388100)
        github.com/rivo/[email protected]/grid.go:664 +0x1af
github.com/rivo/tview.(*Grid).InputHandler.(*Box).WrapInputHandler.func2(0xc000139290?, 0xc001388100?)
        github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Pages).InputHandler.func1(0xc0004220e0, 0xc001388100)
        github.com/rivo/[email protected]/pages.go:334 +0xa2
github.com/rivo/tview.(*Pages).InputHandler.(*Box).WrapInputHandler.func2(0xc0001bf3b0?, 0xc001153e28?)
        github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Application).Run(0xc0004f84b0)
        github.com/rivo/[email protected]/application.go:441 +0x8da
github.com/f1bonacc1/process-compose/src/tui.RunTUIAsync.func1()
        github.com/f1bonacc1/process-compose/src/tui/view.go:604 +0x25
created by github.com/f1bonacc1/process-compose/src/tui.RunTUIAsync in goroutine 1
        github.com/f1bonacc1/process-compose/src/tui/view.go:603 +0x31

onsails avatar Nov 02 '25 09:11 onsails