hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
20.99k stars 880 forks source link

Invalid data when calling `recieve` using wlr-data-control-unstable-v1 to retrieve clipboard selections #6464

Closed imgurbot12 closed 4 months ago

imgurbot12 commented 4 months ago

Bug or Regression?

Bug

System Info and Version

System/Version info ```sh Hyprland, built from branch at commit ea2501d4556f84d3de86a4ae2f4b22a474555b9f (props: bump version to 0.41.0). Date: Mon Jun 10 07:23:06 2024 Tag: v0.41.0, commits: 4794 flags: (if any) System Information: System name: Linux Node name: thelio Release: 6.8.0-35-generic Version: #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 GPU information: 0a:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] [1002:67df] (rev e7) (prog-if 00 [VGA controller]) os-release: PRETTY_NAME="Ubuntu 24.04 LTS" NAME="Ubuntu" VERSION_ID="24.04" VERSION="24.04 LTS (Noble Numbat)" VERSION_CODENAME=noble ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=noble LOGO=ubuntu-logo plugins: hy3 by outfoxxed ver 0.1 ======Config-Start====== Config File: /home/andrew/.config/hypr/hyprland.conf: Read Succeeded # plugins plugin = /usr/local/lib/libhy3.so exec-once = hyprpm reload -n #** Monitors **# # See https://wiki.hyprland.org/Configuring/Monitors/ monitor=,preferred,auto,auto #** Variables **# # Refer to https://wiki.hyprland.org/Configuring/Variables/ $term = wezterm $lock = dynlock -f $player = ~/.local/bin/mediactl $menu = rmenu -r run $deskmenu = rmenu -r drun $wifimenu = rmenu -r network $audiomenu = rmenu -r audio $powermenu = rmenu -r powermenu $screenshot = grim -t png - | tee ~/Pictures/Screenshots/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png | wl-copy $screenclip = slurp | grim -g - -t png - | tee ~/Pictures/Screenshots/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png | wl-copy $background = ~/Pictures/Backgrounds/neon-world.jpg $cl_high = rgb(b4befe) $cl_high2 = rgb(CED2E9) $cl_indi = rgb(d9d8d8) $cl_back = rgb(231f20) $cl_fore = rgb(d9d8d8) $cl_urge = 0xee2e24 #** AutoStart **# # autostart desktop elements exec-once = swaybg -i $background exec-once = hypridle exec-once = ~/.config/waybar/waybar.sh exec-once = redshift -c ~/.config/redshift.conf exec-once = swayosd-server --top-margin 0.1 --style ~/.config/swayosd/style.css exec-once = wclipd daemon -k exec-once = $player daemon # autostart common apps exec-once = brave-browser exec-once = vesktop || discord exec-once = signal-desktop exec-once = spotube || rhythmbox # autostart tray applets exec-once = sh -c 'killall warp-taskbar; warp-taskbar' exec-once = nm-tray exec-once = blueman-applet exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY #** Workspaces **# # workspaces workspace=1,defaultName: workspace=2,defaultName: workspace=3,defaultName: workspace=4,defaultName:ﱮ workspace=5,defaultName:5 workspace=6,defaultName:6 workspace=7,defaultName:7 workspace=8,defaultName:8 workspace=9,defaultName:9 workspace=10,defaultName:10 workspace=11,defaultName: workspace=12,defaultName: workspace=13,defaultName:13 workspace=14,defaultName:14 workspace=15,defaultName:15 workspace=16,defaultName:16 workspace=17,defaultName:17 workspace=18,defaultName: workspace=19,defaultName:19 workspace=20,defaultName: workspace=21,defaultName: workspace=22,defaultName: #** Windows **# # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more # See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules # default workspaces for common apps windowrulev2 = workspace 2, class:^(Brave-browser)$ windowrulev2 = workspace 11, class:^(Signal)$ windowrulev2 = workspace 11, class:^(discord)$ windowrulev2 = workspace 11, class:^(vesktop)$ windowrulev2 = workspace 18, class:^(VirtualBox Manager)$ windowrulev2 = workspace 18, class:^(virt-manager)$ windowrulev2 = workspace 21, class:^(spotube)$ windowrulev2 = workspace 21, class:^(rhythmbox)$ windowrulev2 = workspace 22, class:^(steam.*)$ # floating modifiers and tweaks windowrulev2 = float,class:^(rmenu)$ windowrulev2 = float,class:^(pavucontrol)$ # windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. #** Environment **# # See https://wiki.hyprland.org/Configuring/Environment-variables/ env = XCURSOR_SIZE,24 env = HYPRCURSOR_SIZE,24 #** Keybinds **# # See https://wiki.hyprland.org/Configuring/Keywords/ # See https://wiki.hyprland.org/Configuring/Binds/ $mainMod = SUPER # Sets "Windows" key as main modifier $shiftMod = SUPER_SHIFT # Application/tool shortcuts bind = $mainMod, RETURN, exec, $term bind = $mainMod, R, exec, $menu bind = $mainMod, D, exec, $deskmenu bind = $mainMod, ESCAPE, exec, $powermenu bind = $shiftMod, END, exec, $wifimenu bind = $shiftMod, S, exec, $audiomenu bind = $mainMod, Print, exec, $screenshot bind = $shiftMod, Print, exec, $screenclip # Notifications bind = $mainMod, N, exec, swaync-client --close-latest || dunstctl close bind = $shiftMod, N, exec, swaync-client --close-all || dunstctl close-all # Multimedia bind = $mainMod, M, exec, $player toggle-mic bind = $mainMod, COMMA, exec, $player set-volume -5 bind = $shiftMod, COMMA, exec, $player set-volume -1 bind = $mainMod, PERIOD, exec, $player set-volume +5 bind = $shiftMod, PERIOD, exec, $player set-volume +1 bindel = , XF86AudioRaiseVolume, exec, $player set-volume +5 bindel = , XF86AudioLowerVolume, exec, $player set-volume -5 bindl = , XF86AudioMute, exec, $player toggle-mute bindl = , XF86AudioPlay, exec, $player play-pause bindl = , XF86AudioNext, exec, $player next bindl = , XF86AudioPrev, exec, $player previous bindl = $mainMod, XF86AudioNext, exec, $player shift bindl = $mainMod, XF86AudioPrev, exec, $player unshift # Brightness Controls bind = $mainMod, BRACKET_LEFT, exec, lighctl -5 bind = $shiftMod, BRACKET_LEFT, exec, lightctl -1 bind = $mainMod, BRACKET_RIGHT, exec, lightctl +5 bind = $shiftMod, BRACKET_RIGHT, exec, lightctl +1 # Addtional Controls bindr =,CAPS_LOCK, exec, swayosd-client --caps-lock # Window controls bindn = ,mouse:272, hy3:focustab, mouse bind = $mainMod, W, hy3:changegroup, tab bind = $mainMod, E, hy3:changegroup, untab bind = $shiftMod, Q, killactive, bind = $shiftMod, E, exit, bind = $shiftMod, SPACE, togglefloating, bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, J, togglesplit, # dwindle # Move focus with mainMod + arrow keys bind = $mainMod, left, hy3:movefocus, l bind = $mainMod, right, hy3:movefocus, r bind = $mainMod, up, hy3:movefocus, u bind = $mainMod, down, hy3:movefocus, d # Move windows with shitMod + arrow keys bind = $shiftMod, left, hy3:movewindow, l bind = $shiftMod, right, hy3:movewindow, r bind = $shiftMod, up, hy3:movewindow, u bind = $shiftMod, down, hy3:movewindow, d # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 bind = $mainMod, 2, workspace, 2 bind = $mainMod, 3, workspace, 3 bind = $mainMod, 4, workspace, 4 bind = $mainMod, 5, workspace, 5 bind = $mainMod, 6, workspace, 6 bind = $mainMod, 7, workspace, 7 bind = $mainMod, 8, workspace, 8 bind = $mainMod, 9, workspace, 9 bind = $mainMod, 0, workspace, 10 bind = $mainMod, F1, workspace, 11 bind = $mainMod, F2, workspace, 12 bind = $mainMod, F3, workspace, 13 bind = $mainMod, F4, workspace, 14 bind = $mainMod, F5, workspace, 15 bind = $mainMod, F6, workspace, 16 bind = $mainMod, F7, workspace, 17 bind = $mainMod, F8, workspace, 18 bind = $mainMod, F9, workspace, 19 bind = $mainMod, F10, workspace, 20 bind = $mainMod, F11, workspace, 21 bind = $mainMod, F12, workspace, 22 # Move active window to a workspace with mainMod + SHIFT + [0-9] bind = $mainMod SHIFT, 1, movetoworkspace, 1 bind = $mainMod SHIFT, 2, movetoworkspace, 2 bind = $mainMod SHIFT, 3, movetoworkspace, 3 bind = $mainMod SHIFT, 4, movetoworkspace, 4 bind = $mainMod SHIFT, 5, movetoworkspace, 5 bind = $mainMod SHIFT, 6, movetoworkspace, 6 bind = $mainMod SHIFT, 7, movetoworkspace, 7 bind = $mainMod SHIFT, 8, movetoworkspace, 8 bind = $mainMod SHIFT, 9, movetoworkspace, 9 bind = $mainMod SHIFT, F1, movetoworkspace, 11 bind = $mainMod SHIFT, F2, movetoworkspace, 12 bind = $mainMod SHIFT, F3, movetoworkspace, 13 bind = $mainMod SHIFT, F4, movetoworkspace, 14 bind = $mainMod SHIFT, F5, movetoworkspace, 15 bind = $mainMod SHIFT, F6, movetoworkspace, 16 bind = $mainMod SHIFT, F7, movetoworkspace, 17 bind = $mainMod SHIFT, F8, movetoworkspace, 18 bind = $mainMod SHIFT, F9, movetoworkspace, 19 bind = $mainMod SHIFT, F10, movetoworkspace, 20 bind = $mainMod SHIFT, F11, movetoworkspace, 21 bind = $mainMod SHIFT, F12, movetoworkspace, 22 # Example special workspace (scratchpad) # bind = $mainMod, S, togglespecialworkspace, magic # bind = $mainMod SHIFT, S, movetoworkspace, special:magic # Scroll through existing workspaces with mainMod + scroll bind = $mainMod, mouse_down, workspace, e+1 bind = $mainMod, mouse_up, workspace, e-1 # Move/resize windows with mainMod + LMB/RMB and dragging bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow #** Others **# debug { enable_stdout_logs = true } # https://wiki.hyprland.org/Configuring/Variables/#general general { gaps_in = 5 gaps_out = 3 border_size = 2 # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors # col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg # col.inactive_border = rgba(595959aa) col.active_border = $cl_high $cl_high2 45deg col.inactive_border = $cl_back # Set to true enable resizing windows by clicking and dragging on borders and gaps resize_on_border = false # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on allow_tearing = true layout = hy3 } # https://wiki.hyprland.org/Configuring/Variables/#decoration decoration { rounding = 10 # Change transparency of focused and unfocused windows active_opacity = 1.0 inactive_opacity = 1.0 drop_shadow = true shadow_range = 4 shadow_render_power = 3 col.shadow = rgba(1a1a1aee) # https://wiki.hyprland.org/Configuring/Variables/#blur blur { enabled = true size = 3 passes = 1 vibrancy = 0.1696 } } # https://wiki.hyprland.org/Configuring/Variables/#animations animations { enabled = true # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more bezier = myBezier, 0.05, 0.9, 0.1, 1.05 animation = windows, 1, 7, myBezier animation = windowsOut, 1, 7, default, popin 80% animation = border, 1, 10, default animation = borderangle, 1, 8, default animation = fade, 1, 7, default animation = workspaces, 1, 6, default } # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more dwindle { pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below preserve_split = true # You probably want this smart_split = false force_split = 2 } # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more master { new_is_master = true } # https://wiki.hyprland.org/Configuring/Variables/#misc misc { force_default_wallpaper = 1 # Set to 0 or 1 to disable the anime mascot wallpapers disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :( # Window Swallowing enable_swallow = 1 swallow_regex=^(foot)$ } # https://wiki.hyprland.org/Configuring/Variables/#input input { kb_layout = us kb_variant = kb_model = kb_options = kb_rules = follow_mouse = 1 sensitivity = 0 # -1.0 - 1.0, 0 means no modification. touchpad { natural_scroll = false } } # https://wiki.hyprland.org/Configuring/Variables/#gestures gestures { workspace_swipe = false } # Example per-device config # See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more device { name = epic-mouse-v1 sensitivity = -0.5 } plugin { hy3 { # disable gaps when only one window is onscreen # 0 - always show gaps # 1 - hide gaps with a single window onscreen # 2 - 1 but also show the window border no_gaps_when_only = 0 # default: 0 # policy controlling what happens when a node is removed from a group, # leaving only a group # 0 = remove the nested group # 1 = keep the nested group # 2 = keep the nested group only if its parent is a tab group node_collapse_policy = 2 # default: 2 # offset from group split direction when only one window is in a group group_inset = 10 # default: 10 # if a tab group will automatically be created for the first window spawned in a workspace tab_first_window = false # tab group settings tabs { # height of the tab bar height = 15 # default: 15 # padding between the tab bar and its focused node padding = 5 # default: 5 # the tab bar should animate in/out from the top instead of below the window from_top = false # default: false # rounding of tab bar corners rounding = 3 # default: 3 # render the window title on the bar render_text = true # default: true # center the window title text_center = false # default: false # font to render the window title with text_font = Sans # default: Sans # height of the window title text_height = 8 # default: 8 # left padding of the window title text_padding = 3 # default: 3 # active tab bar segment color col.active = $cl_high # default: 0xff32b4ff # urgent tab bar segment color col.urgent = $cl_urgent # default: 0xffff4f4f # inactive tab bar segment color col.inactive = $cl_back # default: 0x80808080 # active tab bar text color col.text.active = $cl_fore # default: 0xff000000 # urgent tab bar text color col.text.urgent = $cl_fore # default: 0xff000000 # inactive tab bar text color col.text.inactive = $cl_fore # default: 0xff000000 } # autotiling settings autotile { # enable autotile enable = true # default: false # make autotile-created groups ephemeral ephemeral_groups = true # default: true # if a window would be squished smaller than this width, a vertical split will be created # -1 = never automatically split vertically # 0 = always automatically split vertically # = pixel height to split at trigger_width = 0 # default: 0 # if a window would be squished smaller than this height, a horizontal split will be created # -1 = never automatically split horizontally # 0 = always automatically split horizontally # = pixel height to split at trigger_height = 0 # default: 0 # a space or comma separated list of workspace ids where autotile should be enabled # it's possible to create an exception rule by prefixing the definition with "not:" # workspaces = 1,2 # autotiling will only be enabled on workspaces 1 and 2 # workspaces = not:1,2 # autotiling will be enabled on all workspaces except 1 and 2 workspaces = all # default: all } } } ======Config-End======== ```

Description

Hyprland's Implementation of the wlr-data-control-unstable-v1 protocol handles reporting selections for images improperly. On Hyprland, when using a script to listen for non-text clipboard events, the protocol returns a 4byte array which seems to be some sort of memory-address rather than the contents of the image as expected.

Here's an example of a script running on hyprland after copying a few images:

ClipBoardListenMessage { mime_types: ["text/plain;charset=utf-8", "text/plain", "TEXT", "STRING", "UTF8_STRING", "SAVE_TARGETS", "MULTIPLE", "STRING", "text/plain", "text/plain;charset=utf-8", "text/plain", "text/plain;charset=utf-8"], context: Text("") }
ClipBoardListenMessage { mime_types: ["SAVE_TARGETS", "MULTIPLE", "image/png", "text/html"], context: File([121, 62, 236, 1]) }
ClipBoardListenMessage { mime_types: ["SAVE_TARGETS", "MULTIPLE", "image/png"], context: File([111, 80, 236, 1]) }
ClipBoardListenMessage { mime_types: ["SAVE_TARGETS", "MULTIPLE", "image/png", "text/html"], context: File([225, 104, 236, 1]) }

The contents of context: File([...]) should contain the entire contents of the image which is the behavior on other compositors like sway.

How to reproduce

  1. Run Hyprland Compositor.
  2. Use a tool to listen for non-text clipboard events such as https://github.com/imgurbot12/hyprland-clipboard-test
  3. Watch logged events for invalid clipboard-data

Crash reports, logs, images, videos

No response

vaxerski commented 4 months ago

patch.txt does this help?

imgurbot12 commented 4 months ago

patch.txt does this help?

unfortunately not. same issue :(

ClipBoardListenMessage { mime_types: ["SAVE_TARGETS", "MULTIPLE", "image/png", "text/html"], context: File([147, 130, 74, 1]) }
ClipBoardListenMessage { mime_types: ["SAVE_TARGETS", "MULTIPLE", "image/png", "text/html"], context: File([240, 146, 74, 1]) }
ClipBoardListenMessage { mime_types: ["SAVE_TARGETS", "MULTIPLE", "image/png", "text/html"], context: File([190, 151, 74, 1]) }
ClipBoardListenMessage { mime_types: ["SAVE_TARGETS", "MULTIPLE", "image/png", "text/html"], context: File([69, 156, 74, 1]) }
ClipBoardListenMessage { mime_types: ["SAVE_TARGETS", "MULTIPLE", "image/png", "text/html"], context: File([178, 175, 74, 1]) }
ClipBoardListenMessage { mime_types: ["SAVE_TARGETS", "MULTIPLE", "image/png", "text/html"], context: File([213, 179, 74, 1]) }
imgurbot12 commented 4 months ago

I'm seeing this error in the debug logs that might be related?

[LOG] [WLDataDevice] CWLDataDeviceProtocol::onKeyboardFocus: cannot send selection to a client without a data_device
[LOG] [WLDataDevice] New selection for data source 6474fc40b680
[LOG] [WLDataDevice] CWLDataDeviceProtocol::setSelection: cannot send selection to a client without a data_device
[LOG] [WLDataDevice] New selection for data source 6474fc40c500
[LOG] [WLDataDevice] CWLDataDeviceProtocol::setSelection: cannot send selection to a client without a data_device
[LOG] [WLDataDevice] New offer 6474fc4025c0 for data source 6474fc40c500
[LOG] [WLDataDevice]  | offer 6474fc4025c0 supports mime SAVE_TARGETS
[LOG] [WLDataDevice]  | offer 6474fc4025c0 supports mime MULTIPLE
[LOG] [WLDataDevice]  | offer 6474fc4025c0 supports mime image/png
[LOG] [WLDataDevice]  | offer 6474fc4025c0 supports mime text/html
[WARN] [WLDataDevice] New data source before a device was created
[LOG] [WLDataDevice] New data source bound at 6474fc36a300
[LOG] [WLDataDevice] New selection for data source 6474fc36a300
[LOG] [WLDataDevice] New offer 6474fb1375a0 for data source 6474fc36a300
[LOG] [WLDataDevice]  | offer 6474fb1375a0 supports mime text/plain;charset=utf-8
[LOG] [WLDataDevice] New offer 6474fc3d3b40 for data source 6474fc36a300

I know this same library works on sway so I'm not sure why its having trouble finding a data_device.

v4u6h4n commented 4 months ago

Not sure if my issue is related, but my clipboard broke for vscodium after the update, everything else seems to work fine. Related or shall a post a separate issue?

vaxerski commented 4 months ago

possibly related

v4u6h4n commented 4 months ago

Okay. It's kinda strange... I've tested all the other applications I use regularly, and they all work fine, its only vscodium. And I can paste to vscodium from other applications, but if I copy within vscodium it wipes the clipboard.

vaxerski commented 4 months ago

what app are you using? I opened an image in nomacs, and copied buffer, then image, and got this: image

which looks correct

imgurbot12 commented 4 months ago

I've used brave-browser, vencord, signal-desktop, and gimp to copy images all with the same issue. Copying the actual image works most of the time, but the actual selection reporting from the protocol always returns the 4byte array.

Edit: Interestingly, copying buffer using nomacs works as intended vs all the other apps I've used. Edit: I thought some of the apps I was using were native wayland apps but it turns out all of them are likely XWayland. Maybe it has something to do with that bridge for whatever reason. Edit: forcing brave-browser to run in wayland native mode with some experimental flags fixes the issue so its almost definitely XWayland related

vaxerski commented 4 months ago

I'll just pin it under #6247 then.

XWayland's clipboard is buggy and incremental copying is not supported so it's very likely it's that.

likely "wontfix", please switch to using wayland. all of the above apps can use native wayland.

imgurbot12 commented 4 months ago

I'll just pin it under #6247 then.

XWayland's clipboard is buggy and incremental copying is not supported so it's very likely it's that.

likely "wontfix", please switch to using wayland. all of the above apps can use native wayland.

I see, that's rather unfortunate. If that's the case then I have another bug to report which I will open an issue for lol. brave-browser running directly under wayland has a lot of very weird artifacts and issues under Hyprland that I have not seen using sway.

Here's a short vid demonstrating some of them I've encountered in just the small bit of testing I've done. https://imgur.com/a/O2NcCeK

I'm not sure that all the apps I use have native wayland alternatives so It sounds like I may need to move back to sway until some of these things get fixed or a solution is found :/

Edit: issue created at https://github.com/hyprwm/Hyprland/issues/6524

v4u6h4n commented 4 months ago

I'll just pin it under #6247 then.

XWayland's clipboard is buggy and incremental copying is not supported so it's very likely it's that.

likely "wontfix", please switch to using wayland. all of the above apps can use native wayland.

Switched vscodium over to wayland and it fixed the clipboard, so seems like your right.

Oh damn, i need chatterino for my stream, and it doesnt work with wayland currently, hopefully it can be reopened at a later date; even outside of my specific use case, being able to use legacy x11 applications in the future would be useful.