Skip to content

Conversation

@adameska
Copy link
Contributor

@adameska adameska commented Nov 3, 2025

You can now copy selected text via right click or ctrl+c

You can now copy selected text via right click or ctrl+c

Signed-off-by: David Hettinger <[email protected]>
@feloy
Copy link
Contributor

feloy commented Nov 4, 2025

You can now copy selected text via right click or ctrl+c

The problem I can see with mapping the ctrl-c key to Copy is that, if we want to have the same mapping on the terminal tab (which would be a good experience for user), this will not send anymore the ctrl-c character to the terminal. On Linux it is generally Ctrl-shift-C, on Mac Cmd-C (not sure on Windows)

@adameska
Copy link
Contributor Author

adameska commented Nov 5, 2025

You can now copy selected text via right click or ctrl+c

The problem I can see with mapping the ctrl-c key to Copy is that, if we want to have the same mapping on the terminal tab (which would be a good experience for user), this will not send anymore the ctrl-c character to the terminal. On Linux it is generally Ctrl-shift-C, on Mac Cmd-C (not sure on Windows)

Yup, good catch. I'll still copy on ctrl/command-c if there is text highlighted but allow the terminal to process the command as usual after.

@feloy
Copy link
Contributor

feloy commented Nov 5, 2025

There is still an unexpected behaviour for the user, by pressing ctrl-c I would not expect to copy anything to the clipboard, but just send this character. That would overwrite what I have in it

@adameska
Copy link
Contributor Author

adameska commented Nov 5, 2025

There is still an unexpected behaviour for the user, by pressing ctrl-c I would not expect to copy anything to the clipboard, but just send this character. That would overwrite what I have in it

I was mostly doing this based on this comment, but i can either require a flag to be set to enable copying (so ctrl+c only works with logs) or scrap ctrl+c altogether and just leave the right click logic. My windows terminal does allow ctrl+c to copy text (or right click) like this code is doing but maybe linux doesn't support that... even if something is currently running, if something is selected copy takes precedence. But i'll defer to your judgement what you would like to do/support. My main goal here is that there's some mechanism so i can copy errors from logs.

image

@feloy
Copy link
Contributor

feloy commented Nov 6, 2025

Hello @adameska , I have added some info on an issue tracking the same problem on Podman Desktop: podman-desktop/podman-desktop#4130 (comment)

For your situation, I can see these different possibilities to be able to copy-paste (you are working on a Windows system if I understand correctly?):

  • use Ctrl-Insert and Shit-Insert which should work without any change
  • make some change on the code to allow the contextMenu, which would make possible to copy/paste from the contextual menu
  • make the changes your are proposing, but by choosing the shortcut(s) depending on the host system (Mac, Linux, Windows). For this, the podman desktop api exposes flags which can give this information (https://github.com/podman-desktop/podman-desktop/blob/main/packages/extension-api/src/extension-api.d.ts#L4398-L4414). This API is not accessible by the frontend directly, it must be accessed by the backend, and exposed to the frontend

@adameska
Copy link
Contributor Author

Hello @adameska , I have added some info on an issue tracking the same problem on Podman Desktop: podman-desktop/podman-desktop#4130 (comment)

For your situation, I can see these different possibilities to be able to copy-paste (you are working on a Windows system if I understand correctly?):

  • use Ctrl-Insert and Shit-Insert which should work without any change
  • make some change on the code to allow the contextMenu, which would make possible to copy/paste from the contextual menu
  • make the changes your are proposing, but by choosing the shortcut(s) depending on the host system (Mac, Linux, Windows). For this, the podman desktop api exposes flags which can give this information (https://github.com/podman-desktop/podman-desktop/blob/main/packages/extension-api/src/extension-api.d.ts#L4398-L4414). This API is not accessible by the frontend directly, it must be accessed by the backend, and exposed to the frontend

Thanks for the info, i've gotten fairly busy with work but when i find time i'll hook into the env to determine mac vs windows to alter the command/ctrl key checking. I think the context menu would be nice but that's pretty non-standard in a terminal window from my experience.

@feloy
Copy link
Contributor

feloy commented Nov 12, 2025

Thanks for the info, i've gotten fairly busy with work but when i find time i'll hook into the env to determine mac vs windows to alter the command/ctrl key checking. I think the context menu would be nice but that's pretty non-standard in a terminal window from my experience.

I've created a PR to help you get the platform from the frontend: #465

Signed-off-by: David Hettinger <[email protected]>
@adameska adameska requested review from a team, benoitf and feloy as code owners November 13, 2025 14:33
@adameska adameska requested review from gastoner and removed request for a team November 13, 2025 14:33
Signed-off-by: David Hettinger <[email protected]>
@adameska
Copy link
Contributor Author

Thanks for the info, i've gotten fairly busy with work but when i find time i'll hook into the env to determine mac vs windows to alter the command/ctrl key checking. I think the context menu would be nice but that's pretty non-standard in a terminal window from my experience.

I've created a PR to help you get the platform from the frontend: #465

This is great! Thanks so much for adding this, I've incorporated your changes and stream lined copy shortcut behavior with right click (this is how my windows terminal functions and it's a great experience to me).

Copy link
Contributor

@feloy feloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add in the PR description all the effects added to the terminal, for reviewers to have a clear understanding of the changes? (right click, which shortcut depending on platform, etc)

adameska and others added 5 commits November 13, 2025 09:28
Signed-off-by: Hettinger, David <[email protected]>
Signed-off-by: David Hettinger <[email protected]>
Signed-off-by: Adameska <[email protected]>
Add remote mocks for API_SYSTEM in tests

Signed-off-by: David Hettinger <[email protected]>
Copy link
Contributor

@feloy feloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested OK:

On Linux:

  • ctrl-shift-c copies the text
  • right-click copies the word below the pointer

On Windows:

  • Ctrl-c copies the text
  • right-click copies the word below the pointer

On Mac:

  • Cmd-c copies the text
  • right-click copies the word below the pointer

Thanks @adameska for this work!

@feloy
Copy link
Contributor

feloy commented Nov 19, 2025

@benoitf @gastoner can you PTAL?

Copy link
Contributor

@benoitf benoitf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the component should not have like a workaround to copy text, but delegates to the API provided

@adameska adameska requested a review from benoitf November 19, 2025 15:23
Copy link

@gastoner gastoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screencast_20251120_114154.webm

I was not able to copy the text on Linux using ctrl+shift+c nor ctrl+c :(

@feloy
Copy link
Contributor

feloy commented Nov 20, 2025

Screencast_20251120_114154.webm
I was not able to copy the text on Linux using ctrl+shift+c nor ctrl+c :(

Looking at the kubernetes logo in the menu (which is gray), you are testing the internal kubernetes, not the extension (with a blue icon in the menu)

@benoitf benoitf dismissed their stale review November 20, 2025 13:51

discarding due to changes

@feloy feloy requested a review from gastoner November 21, 2025 08:21
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.

4 participants