-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Interact with Wayland clipboard via cli #926
Comments
Keeping this open until we can read from the clipboard too. |
Thinking about this I'm not sure if reading from the clipboard is a feature you want to implement? As the copy to clipboard functionality works over swaymsg, wouldn't it be possible for malicious processes to read the clipboard if there was a |
@embik, I imagine if |
You can also do things like run swaygrab to capture the screen or swaymsg to use swaymsg's IPC permissions. Part of a secure system is sandboxing things you want to keep under control, which includes removing access to |
So i will probably try to implement it the next days (will require to expose more of wlc's internals). A few questions:
|
Well, sway commands cannot output information, similar to i3 commands (I want to change this in the future - but not now). For the time being you should add a new IPC message type and we can use
Sure, that's fine for now, but don't paint us into a corner such that we can't change that later.
You get security for new commands for free, you should just set their permissions appropriately in https://github.com/SirCmpwn/sway/blob/master/include/sway/config.h#L223 Then, when you implement it in ipc-server.c, check it with something similar to this: https://github.com/SirCmpwn/sway/blob/master/sway/ipc-server.c#L353 And add an IPC subcommand so that this can be configured: https://github.com/SirCmpwn/sway/blob/master/sway/commands/ipc.c |
Thanks for the pointers, am on it. |
I don't think that this was actually resolved by Cloudef/wlc#273, although GitHub automatically closed this. |
Is there a way to set the clipboard data from cli? |
|
Got it. Couldn't find it in documentation. I may send a PR to add it to the man page. |
Note that @bugaevc's solution uses a hack to get keyboard focus (which spawns a transparent window, probably resulting in flickers in Sway because it shows up as tiling). This should be fixed by the clipboard manager protocol we're working on. |
Yes — and the plan is, when new protocol materializes, make wl-clipboard automatically use it instead of the transparent surface hack when running under wlroots-based compositors. |
@bugaevc @emersion Do either of you happen to know if there is anyway the window might be configured to spawn in the background? For example, I'm not sure if Right now the flickering is quite bad with Neovim / Sway - every time text is yanked, the window temporarily resizes / flickers. |
wl-paste uses a hack as of now. You're encouraged to contribute to make it so there's no hack anymore instead of making the hack more hacky. |
@khughitt I found the following to work: |
@YaLTeR That did the trick! Thanks for the suggestion! |
This is now fixed in wl-clipboard master by using another hack — using the layer-shell protocol instead of xdg-shell, the popup surface can be made to float automatically; there no need for the user to configure anything. As far as implementing a proper solution instead of a bunch of hacks goes,
The new protocol is now implemented both from the Sway/wlroots side and from the wl-clipboard side, though neither implementation is yet merged into the respective master branches. |
Note that when security rules will be implemented, layer-shell will be locked down. |
As mentioned in #1919 (a duplicate of this request) and swaywm/wlr-protocols#20: https://github.com/bugaevc/wl-clipboard is the current way of setting the Wayland clipboard from the command line. The issues regarding the transparent window appear to be resolved and the |
As long as there's no clarification on #913 (how to manage interaction between X and Wayland clipboard) I'd love to interact with sway's clipboard via a cli application such as swaymsg. I'm using pass which is using xclip by default. It would be lovely to pipe passwords from pass (or any other cli application) into the Wayland clipboard.
The text was updated successfully, but these errors were encountered: