Cockpit: Copy and paste to terminal could improve usability

Created on 24 Mar 2015  Â·  18Comments  Â·  Source: cockpit-project/cockpit

From time to time I use copy and paste in terminal. It's not necessary but it could improve usability.

enhancement

Most helpful comment

This was driving me crazy. Using Windows 10 + Chrome 71
Press Ctrl+a first. Then Ctrl-v.

Someone else can probably explain why it works this way. I'm a little lost as to why, but I'm super happy it does.

All 18 comments

is anyone working on this issue? if so, what is the status?

I don't know of anyone working on this issue. Likely the first step is migrating our use of term.js to xterm.js instead, since the latter is maintained going forward.

Indeed, this would be very welcome. Great stuff by the way.

I'd love this too

Is it the task (copy and paste in terminal) in progress or wont it to be supported?

What exactly did you mean by "could improve usability"? It was broken for a long time, but #7983 should at least allow copy and pasting with the right click menu.

Did you imagine something in addition to that? In #7956, @garrett suggested that Ctrl+Shit+C could be used, similar to how gnome terminal does it.

Windows 10, IE 11, Chrome Version 63.0.3239.132 copy & paste not working

Firefox 58.0.2 on Linux (Fedora 27, Cockpit built from master):

  • Copy works after selecting an item and right clicking on the terminal titlebar. Right-clicking in the terminal itself (where I'd expect to right-click) does not work.
  • Paste does not work at all.

Is this feature considered for next release? This is a must feature for us to start using cockpit.

Okay, so paste is working on linux machines chrome and chromium and not working in firefox.
We can work with this. Thanks!

Heya,

I see thing is working on chorme. However I can not paste into the terminal. I'm on version 172, Google Chrome om Windows and I do not get an option to paste.

Am I missing a step here?

Win10 64bit, Chrome68.0.3440.75 (official), x64
copy working but paste into terminal not working.

Copy / Paste would be appreciated.

I too would love to have this functionality. Windows using Chrome here, not that I can't setup a Fedora device, but it's a nice to have.

Very missing features indeed. At least Paste.

Context menu copy & paste

I've tested several browsers and their ability to copy and paste text in Cockpit's terminal.

Here are the steps I used for testing:

  1. Select text in terminal
  2. Secondary mouse click ("right click")
  3. Click "Copy"
  4. Deselect text in terminal (this is _important_)
  5. Secondary mouse click ("right click")
  6. Click "Paste"

  | Copy | Paste
-- | -- | --
Firefox 64.0 | :heavy_check_mark: | :heavy_check_mark:
Chromium 71.0.3578.98 | :heavy_check_mark: | :heavy_check_mark:
Epiphany 3.30.2 (WebKit 2.22.5) | :heavy_check_mark: | :heavy_multiplication_x:
Safari 11.1.2 (WebKit 11605.3.8.1) on OS X 10.11.6 | :heavy_check_mark: | :heavy_check_mark:
Edge 42.17134.1.0 (EdgeHTML 17.17134) | :white_check_mark: | :heavy_multiplication_x:

:white_check_mark:: _Edge can copy, but it's a bit fiddly with the right click, as it sometimes dismisses the selection and sometimes does not show the context menu._

_Note: With the exceptions of Safari and Edge, all browsers were tested on Fedora 29._

Keyboard shortcuts

Ctrl-C / Ctrl-V generally do not work for copying and pasting in a terminal, as the commands are entered into the terminal instead. This is expected, as it's how terminals work. Ctrl-C is rather critical too, for breaks.

On most Linux terminals, including GNOME-Terminal, Ctrl-Shift-C / Ctrl-Shift-V are workarounds for copying and pasting. There is not special handler in the Cockpit terminal to implement these workarounds.

Alternatively, it could also be possible to make Ctrl-C / Ctrl-V do copy/paste and use Ctrl-Shift-C / Ctrl-Shift-V as workarounds.

On a Mac, the ⌘-C and ⌘-V shortcuts do not work. They simply should. Perhaps the JavaScript can be augmented to make this work?

Recommendations

  • Add a "Shortcuts" menu to the titlebar

    • "Copy" and "Paste" should be at the top (or even as separate top-level buttons next to the menu)

    • Include important key combos for terminal usage that clash with the browser, with their typical function in a terminal

    • Figure out a browser-friendly shortcut to activate the menu with the keyboard, with a way to quickly select items in the menu (like alt-key underlines in a desktop app)

  • Implement key combo workarounds where necessary

    • Ctrl-Shift-C / Ctrl-Shift-V that implement copy & paste or passthroughs for Ctrl-C / Ctrl-V

    • Consider Ctrl-Shift-W for clearing the previous word, Ctrl-Shift-L for clearing the screen, etc.

    • Perhaps add a "Compatibility", "Settings", or "â›­" menu with toggles for each of these workarounds, in case a program in the terminal also uses Ctrl-Shift-*?

    • Hook up ⌘-C and ⌘-V for OS X / macOS

Summary

Copying & pasting via a right-click works in most (but not all) browsers — but it's not discoverable enough. (Generally, pasting via a context menu needs text de-selected first.) In addition, other terminals and applications use alternate means for copying & pasting. Also, the standard desktop copy/paste keyboard shortcuts do not work (nor do the usual work-arounds).

Cockpit should make copying & pasting more discoverable through a visible menu (or even action buttons) and keyboard shortcuts.

Note: I had additional suggestions in a different bug @ https://github.com/cockpit-project/cockpit/issues/7956#issuecomment-339296754 & https://github.com/cockpit-project/cockpit/issues/7956#issuecomment-339365141 (including sticky keys and such). Both were written a long time ago, but probably still apply.

This was driving me crazy. Using Windows 10 + Chrome 71
Press Ctrl+a first. Then Ctrl-v.

Someone else can probably explain why it works this way. I'm a little lost as to why, but I'm super happy it does.

https://github.com/cockpit-project/cockpit/commit/8eb0e5e6 provides copy and paste through context menu. Also it makes shortcuts discoverable (ctrl+Insert and shift+insert).

Others combinations can be added, but as discussed, crtl+c and ctrl+v generally are not great choice, ctrl+shift+c/v can be implemented, but for example ctrl+shift+c is already reserved in firefox.

Closing, if anyone thinks there is something missing please reopen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jacksnodgrass picture jacksnodgrass  Â·  6Comments

kxxoling picture kxxoling  Â·  5Comments

Discusal picture Discusal  Â·  4Comments

kai4785 picture kai4785  Â·  4Comments

vazquezrodjoel picture vazquezrodjoel  Â·  8Comments