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

nxagent: add keystrokes to switch clipboard mode on the fly #1047

Open
wants to merge 5 commits into
base: 3.6.x
Choose a base branch
from

Conversation

xavierog
Copy link

This pull request adds nxagent keystrokes to switch clipboard mode on the fly.
A typical use case for this feature is to prevent access to the real X server's clipboard most of the time, except for a couple seconds when this actually proves necessary. Otherly put, it simply makes nxagent's"clipboard mode" feature more flexible. Should it prove unnecessary or harmful to some users, the whole thing can be disabled by reconfiguring keystrokes.

@uli42
Copy link
Member

uli42 commented Sep 20, 2022

I am sorry that you did not get a reaction to this so far - I just detected it today and will have a look at it

Copy link
Member

@uli42 uli42 left a comment

Choose a reason for hiding this comment

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

I don't see code that (re-)initializes the clipboard when switching between modes. This might especially become important when nxagent was started with clipboard=none initially.

Also we need a way to disable the keystrokes since the feature might compromise security (if the admin sets the clipboard to some mode in the global config it should not be possible for the user to enable it on the fly.

case doClipboardServer:
case doClipboardNone:
{
nxagentSwitchClipboardMode(ClipboardBoth + result - doClipboardBoth);
Copy link
Member

Choose a reason for hiding this comment

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

I don't really like that calculation since it is not self-explanatory. Please add at least a comment the thought behind this calculation. There's another location where I saw that same calculation, comment there too, please

case KEYSTROKE_SET_CLIPBOARD_CLIENT:
case KEYSTROKE_SET_CLIPBOARD_SERVER:
case KEYSTROKE_SET_CLIPBOARD_NONE:
*result = doClipboardBoth + stroke - KEYSTROKE_SET_CLIPBOARD_BOTH;
Copy link
Member

Choose a reason for hiding this comment

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

explain calculation (as mentioned above)

@sunweaver
Copy link
Member

@xavierog Can you please give feedback on the questions asks in the code review of this PR? Thanks.

@uli42 I @xavierog will not respond, I think the idea of being able to switch between clipboard modes is basically great, but we should add yet another option that enables/disables this feature server-side/client-side. Disabled clipboard (by admin / by client user) is a feature and we would undermine it here. What do you think?

@sunweaver
Copy link
Member

sunweaver commented Apr 27, 2023

@uli42 I forgot to finish my sentence above. What you be willing to finalize this PR if there is not feedback from @xavierog?

@xavierog
Copy link
Author

Hi!
Indeed, this PR is getting close to being one year old.
In practice, I am not dead, just super busy. Good news, it should get better very soon, and I should be able to dive again in this patch, answer the questions and apply the suggestions above.

@sunweaver
Copy link
Member

@xavierog This is awesome to hear!!!

@uli42
Copy link
Member

uli42 commented Jun 26, 2024

I agree that it is a nice feature. We could even extend it to a mode where only one clipboard action is allowed (pasting once) and afterwards it is disabled again. This way you get a bit more security.

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.

3 participants