-
-
Notifications
You must be signed in to change notification settings - Fork 897
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
Clipboard synchronization between wayland and xwayland clients broken #6132
Comments
Can confirm. I cannot copy/paste between Firefox and electron apps like Discord, Steam, and Obsidian. System info
|
I think Varxy mentioned that Copy/Paste will be broken until the xwayland rewrite is completed. |
I suppose this can be closed if he wants in that case, since it's a planned issue. |
we can keep it to avoid dupes, I'll just link 6086 to this |
Things seem to work for me with XClip? https://github.com/astrand/xclip Try using this as a workaround for now. |
Would i have to change the keybindings for copy & paste then aswell? And does XClip work with wayland applications? |
Little script I'm using for syncing clipboard as workaround
|
I have simply built and am sitting on the commit before the rewrites (4cdddcf) until the xwayland rewrite is merged. |
Sorry for the dumb question, but how do I clone the repo b4 the commits? |
When this is resolved and you want to go back to using your regular installation method (I assume AUR -git), just run |
@Ghosthree3 Thanks. Had figured it out already by searching the web ;-) . Thanks for the idea nd everyone for this grt project |
does anyone know how to pin the commit for nix flake inputs? hyprland = {
url = "git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=4cdddcfe466cb21db81af0ac39e51cc15f574da9&submodules=1";
}; but it fails
UPDATE: hyprland = {
type = "git";
url = "https://github.com/hyprwm/Hyprland";
submodules = true;
rev = "4cdddcfe466cb21db81af0ac39e51cc15f574da9";
}; it was able to build (with some errors which, i believe, is due to submodules = true)
|
@jfvillablanca that looks like an unreliable internet connection. git clone is not resilient to connection resets.
|
I'm not precisely an expert here, but just in case this is useful for somebody: As a researcher, when I need further compatibility with MS Office, I use WPS Office and this issue was bothering me for quite a while. I found the forked script and I modified it a little bit so it's completely functional (I'm not sure why I was getting lots of new line characters when copy-pasting with the original): https://gist.github.com/andriandreo/cc48e2d67c389919e18c54429d768c1f |
The issue is closed, but as far as I can tell the issue is still there in 0.41.0. |
there already is an issue open #6247 concerning a specific subset of xwayland applications |
This is happening to me since v0.41.0 ._. |
Commits to master on A slightly modified version of @Elbtalkessel 's little sync script. gist: https://gist.github.com/armenr/81b77587c1dda1d00d1c1c9541dcda94 I took the liberty of adding:
Script below: #!/usr/bin/env sh
#
# Two-way clipboard syncronization between Wayland and X11, with cliphy support!
# !! Recommended use: Drop this file off @ /usr/local/bin/clipsync && make it executable
# Requires: wl-clipboard, xclip, clipnotify.
# Modified from: https://github.com/hyprwm/Hyprland/issues/6132#issuecomment-2127153823
#
# Usage:
# clipsync watch [with-notifications|without-notifications] - run in background.
# clipsync stop - kill all background processes.
# echo -n any | clipsync insert [with-notifications|without-notifications] - insert clipboard content from stdin.
# clipsync help - display help information.
#
# Workaround for issue:
# "Clipboard synchronization between wayland and xwayland clients broken"
# https://github.com/hyprwm/Hyprland/issues/6132
#
# Also pertains to:
# https://github.com/hyprwm/Hyprland/issues/6247
# https://github.com/hyprwm/Hyprland/issues/6443
# https://github.com/hyprwm/Hyprland/issues/6148
# Updates clipboard content of both Wayland and X11 if current clipboard content differs.
# Usage: echo -e "1\n2" | clipsync insert [with-notifications|without-notifications]
insert() {
# Read all the piped input into variable.
value=$(cat)
wValue=$(wl-paste -n 2>/dev/null || echo "")
xValue=$(xclip -o -selection clipboard 2>/dev/null || echo "")
notify() {
if [ "$1" != "without-notifications" ]; then
notify-send -u low -c clipboard "$2" "$value"
fi
}
if [ "$value" != "$wValue" ]; then
notify "$1" "Wayland"
echo -n "$value" | wl-copy
# Add to cliphist if it's installed
if command -v cliphist >/dev/null 2>&1; then
echo -n "$value" | cliphist store
fi
fi
if [ "$value" != "$xValue" ]; then
notify "$1" "X11"
echo -n "$value" | xclip -selection clipboard
# Add to cliphist if it's installed
if command -v cliphist >/dev/null 2>&1; then
echo -n "$value" | cliphist store
fi
fi
}
# Watch for clipboard changes and synchronize between Wayland and X11
# Usage: clipsync watch [with-notifications|without-notifications]
watch() {
# Add a small delay to ensure clipboard services are initialized
sleep 1
notification_mode=${1:-with-notifications}
# Wayland -> X11
wl-paste --type text --watch bash -c "clipsync insert $notification_mode" &
# X11 -> Wayland
while clipnotify; do
xclip -o -selection clipboard 2>/dev/null | clipsync insert "$notification_mode"
done &
}
# Kill all background processes related to clipsync
stop_clipsync() {
pkill -f "wl-paste --type text --watch"
pkill clipnotify
pkill -f "xclip -selection clipboard"
pkill -f "clipsync insert"
}
help() {
cat << EOF
clipsync - Two-way clipboard synchronization between Wayland and X11, with cliphist support
Usage:
clipsync watch [with-notifications|without-notifications]
Run clipboard synchronization in the background.
Options:
with-notifications (default): Show desktop notifications for clipboard changes.
without-notifications: Operate silently without notifications.
clipsync stop
Stop all background processes related to clipsync.
echo -n "text" | clipsync insert [with-notifications|without-notifications]
Insert clipboard content from stdin.
Notification options work the same as in the watch command.
clipsync help
Display this help information.
Requirements: wl-clipboard, xclip, clipnotify
Optional: cliphist (for Hyprland users)
EOF
}
case "$1" in
watch)
watch "$2"
;;
stop)
stop_clipsync
;;
insert)
insert "$2"
;;
help)
help
;;
*)
echo "Usage: $0 {watch [with-notifications|without-notifications]|stop|insert [with-notifications|without-notifications]|help}"
echo "Run '$0 help' for more information."
exit 1
;;
esac ...And now, 1Password is usable again 🚀 |
Fix doesn't work for me |
Hyprland Version
System/Version info
Bug or Regression?
Regression
Description
Trying to copy/paste data between wayland and xwayland clients is broken as of 121d3a7.
An error can be observed from xwayland clients when trying to paste something copied from a wayland client if the xwayland clipboard is empty.
But if there exists something on the xwayland clipboard (because of a copy from an existing xwayland client) that will be pasted and no error given.
When pasting into a wayland client, the last copy from a wayland client is used (if it still exists), regardless of the existence of a valid xwayland clipboard or not.
There was one time when playing around copying and pasting I managed to crash Hyprland. I think while attempting to close an xwayland window with something on its clipboard, which would hang invisibly.
How to reproduce
Open two windows, one under wayland, one under xwayland, and try to copy paste between them.
I was testing by opening a terminal (
kitty
) under wayland, then using it to load an x11 copy of itself (kitty -o linux_display_server=x11
) and trying to copy paste between them.First noticed because I was unable to copy paste things from my browser into Discord.
Crash reports, logs, images, videos
No response
The text was updated successfully, but these errors were encountered: