Skip to content

Unable to read image placed by Spectacle #104

@kmod-midori

Description

@kmod-midori

Environment: Linux with X11, the application is being run as root because it also uses evdev.

For images copied from Chrome, everything works fine, but when I try to read a screenshot produced by Spectacle, this happens:

2023-05-08T12:26:31.282Z TRACE [arboard::platform::linux::x11] Started serve requests thread.
2023-05-08T12:26:31.282Z TRACE [arboard::platform::linux::x11] Trying to get the clipboard data.
2023-05-08T12:26:31.283Z TRACE [arboard::platform::linux::x11] Finished `convert_selection`
2023-05-08T12:26:31.283Z TRACE [arboard::platform::linux::x11] Read SelectionNotify
2023-05-08T12:26:31.283Z TRACE [arboard::platform::linux::x11] Clipboard server window is being destroyed x_x
get_clipboard_content() = Err(
    Unknown { .. } - "Unknown error while interacting with the clipboard: incorrect type received from clipboard",
)

Output of xclip -selection clipboard -t TARGETS -o

Chrome

TIMESTAMP
TARGETS
SAVE_TARGETS
MULTIPLE
image/png
text/html

Spectacle

application/x-qt-image
x-kde-force-image-copy
image/png
image/avif
image/bmp
image/bw
image/cur
image/eps
image/epsf
image/epsi
image/heic
image/heif
image/icns
image/ico
image/jp2
image/jpeg
image/jpg
image/jxl
image/pbm
BITMAP
image/pcx
image/pgm
image/pic
image/ppm
PIXMAP
image/rgb
image/rgba
image/sgi
image/tga
image/tif
image/tiff
image/wbmp
image/webp
image/xbm
image/xpm
TARGETS
MULTIPLE
TIMESTAMP
SAVE_TARGETS

As shown here, both cases do provide image/png, I wonder why this is not working, as the code in this library says that this should never happen.

BTW, since we already uses the image crate, why not provide a function that reads a PNG from the clipboard (this can be behind a feature flag, since we don't need to decode images on Windows)? We might be able to skip some decompression and compression for folks who actually need a PNG or other compressed format to work on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-UNIXWork related to X11 or Wayland on UNIX platformsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions