this post was submitted on 05 Feb 2024
33 points (97.1% liked)

Linux

48099 readers
807 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I'm trying to improve the clipboard sync situation, i've realized that if I can make it so that a bindsym only applies when an xwayland window is in focus, I can basically do

bindsym --release Control+c exec "xclip -o | wl-copy"

And it'll automatically sync the clipboard... however, I can't find a way to make the bindsym only run on xwayland windows, as, if this runs on a wayland window, it'll just overwrite the wayland clipboard with the last xwayland clipboard.

I've discovered you can match all xwayland windows with "swaymsg [shell='xwayland']" but I can't figure out how to make a bindsym only work if that is in focus

edit: I figured out the following:

bindsym --release Control+c exec swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | .shell' | grep -Eq 'xwayland' && xclip -o | wl-copy

^^ that SHOULD WORK in theory, but it doesn't, because xclip outputs what it remembers as soon as the command starts, and as a result, the string gets messed up... I cannot figure out for the life of me why running "xclip -o | wl-copy" fixes it but not that. please help.

bindsym --release Control+c exec swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | .shell' | grep -Eq 'xwayland' && [xclip -o | wl-copy]

^^does not fix it, unfortunately

here's an issue tracker: https://github.com/swaywm/sway/issues/7958

all 7 comments
sorted by: hot top controversial new old
[–] lily33@lemm.ee 3 points 9 months ago* (last edited 9 months ago) (2 children)

I'm just guessing, but you can try brackets around xclip -o | wl-copy in the long command.

[–] Communist@lemmy.ml 1 points 9 months ago* (last edited 9 months ago)

HOLY SHIT IT WORKS

WHY DOES THAT WORK?

I googled what the brackets do but I still don't understand why that fixes it, but it does. Thank you so much. You cannot imagine how much annoyance this issue has caused me over the years.

edit: SCRATCH THAT

I've found a situation where xclip -o outputs the correct thing, but wl-paste is outputting something different and incorrect, even if I run my bindsym

xclip -o | wl-copy would fix this, if i ran it from alacritty, however, sway isn't doing it right.

Sigh.

[–] jokro@feddit.de 2 points 9 months ago (2 children)

Not answering your question, but since i haven't noticed any clipboard issues on GNOME does Sway maybe have an option to fix the Wayland<->xwayland sync ?

[–] Max_P@lemmy.max-p.me 1 points 9 months ago (1 children)

Not an issue on KDE either. This smells strongly of an XY problem. Clipboard should be in sync.

[–] Communist@lemmy.ml 1 points 9 months ago

It's specifically citrix workspace that has issues.

[–] Communist@lemmy.ml 1 points 9 months ago

It's specifically citrix workspace that has issues.