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.

  • lily33@lemm.ee
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    9 months ago

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

  • jokro@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    9 months ago

    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
      link
      fedilink
      arrow-up
      0
      ·
      9 months ago

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