You are not logged in.

#1 2024-03-30 14:38:24

pm3840
Member
Registered: 2013-12-16
Posts: 61

[SOLVED] xfce4 screenshot cannot be saved to clipboard

Not sure how to troubleshoot this. Any idea?

Last edited by pm3840 (2024-03-31 22:48:40)

Offline

#2 2024-03-30 17:23:08

seth
Member
Registered: 2012-09-03
Posts: 51,739

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

No.
https://bbs.archlinux.org/viewtopic.php?id=57855

I'd "scrot -F - | xsel -i", you probably want to https://man.archlinux.org/man/extra/xfc … ter.1.en#c and for everything else, you'll have to elaborate a bit on the problem.
Like, eg., describing it and also the environment (eg. if you're trying that in a wayland session, it will very most likely not work)

Offline

#3 2024-03-30 18:21:22

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

Well, it's all GUI. I've checked journalctl but nothing is there.
clipman is running and its tray icon is on taskbar. No problem there too.

Let me try though.
I open a terminal and run this "xfce4-screenshooter -f -c". There's no error. Same goes for "xfce4-screenshooter -r -c"
What else can be attached here?

$ xfce4-screenshooter -f -c
$ echo $?
0

The alt for me is to open captured in chromium and then go to chromium and do "copy image"

Last edited by pm3840 (2024-03-30 18:22:47)

Offline

#4 2024-03-30 18:53:13

seth
Member
Registered: 2012-09-03
Posts: 51,739

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

xfce4-screenshooter -f -c
xsel -o > /tmp/test.file
file /tmp/test.file
xsel -o -b > /tmp/test.file
file /tmp/test.file

Offline

#5 2024-03-30 20:05:16

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

$ xfce4-screenshooter -f -c
$ xsel -o > /tmp/test.file
$ file /tmp/test.file
/tmp/test.file: ASCII text
$ xsel -o -b > /tmp/test.file
$ file /tmp/test.file
/tmp/test.file: ASCII text, , with no line terminators
$

Here it is. Thank you!

Last edited by pm3840 (2024-03-30 20:08:05)

Offline

#6 2024-03-30 22:57:51

seth
Member
Registered: 2012-09-03
Posts: 51,739

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

So those are text files, it seems screeshooter doesn't put anything onto the clipboard.
Do you use some sort of clipboard manager?

There apparently used to be https://bugzilla.xfce.org/show_bug.cgi?id=15244 - can you get screenshots of small(er) screen fractions into the clipboard?

Offline

#7 2024-03-31 00:05:54

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

Yes I use xfce4 clipman. According to doc https://docs.xfce.org/apps/xfce4-screenshooter/usage it's required for this feature to work

Copy to the clipboard option allows you to paste the screenshot in another application, such as a word processor. This option is only available when a clipboard manager is running."

Chromium "copy image" works just fine, even big size image.

I see that quite a few bug reports were determined to be invalid. And the new bug tracker at https://gitlab.xfce.org/apps/xfce4-screenshooter doesn't have much.
I don't think there's a second clipboard manager running if that matters.

Offline

#8 2024-03-31 00:31:17

toz
Member
Registered: 2011-10-28
Posts: 497

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

When you copy the image to the clipboard, does clicking on the clipboard icon in the panel display the image in the history? If not, can you confirm your version of xfce4-screenshooter?

Edit: the clipboard contents should be saved to ~/.cache/xfce4/clipman - check if the image file shows up there.

Last edited by toz (2024-03-31 00:53:44)

Offline

#9 2024-03-31 01:27:26

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

No. History is not touched. Version is the latest available:

$ pacman -Q|grep screensh
xfce4-screenshooter 1.10.5-1

xfce4-screenshooter doesn't affect ~/.cache/xfce4/clipman/image0.png. Chromium "copy image" does.

Offline

#10 2024-03-31 02:46:15

toz
Member
Registered: 2011-10-28
Posts: 497

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

Perhaps you could do a quick debug build of the package to see exactly what's happening (no need to actually install this build)?
-snip-
This will generate debug output which you can post back.

You may need to install some extra packages like base-devel, intltool and xfce4-dev-tools, but you can remove them later.

Edit: probably not a good idea to just drop random code here. You can find the debug parameters here. You can create a temporary build, without actually installing, by grabbing the source from the official upstream source repository (or building directly from git) with "--enable-debug=full". This will generate debug output when you manually run xfce4-screenshooter from the build's "src" directory.

Last edited by toz (2024-03-31 03:00:38)

Offline

#11 2024-03-31 08:54:58

seth
Member
Registered: 2012-09-03
Posts: 51,739

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

screenshooter depends on xclip, which doesn't ship a library…

scrot -F - | xclip -i
xclip -o > /tmp/test.png
file /tmp/test.png

Offline

#12 2024-03-31 13:03:11

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

Excuse my C lang skill.

I find the logic here weird like the actions are offered as radio buttons not check boxes so why does the code do more than specified? screenshot is saved to "tmp" directory anyway when "copy to clipboard"
https://gitlab.xfce.org/apps/xfce4-scre … _type=tags

if (sd->action & CLIPBOARD)
    screenshooter_copy_to_clipboard (sd->screenshot);

if (sd->action & SAVE)
    {
      ...
   }
else {
      GFile *temp_dir = g_file_new_for_path (g_get_tmp_dir ());
      gchar *temp_dir_uri = g_file_get_uri (temp_dir);
      gchar *filename = screenshooter_get_filename_for_uri (temp_dir_uri,
                                                            sd->title,
                                                            sd->last_extension,
                                                            sd->timestamp);
      save_location = screenshooter_save_screenshot (sd->screenshot,
                                                     temp_dir_uri,
                                                     filename,
                                                     sd->last_extension,
                                                     FALSE,
                                                     FALSE);
}

This part is straight forward. According to GTK doc GTK takes care of everything pretty much.
https://docs.gtk.org/gtk3/type_func.Cli … splay.html
https://docs.gtk.org/gtk3/method.Clipbo … image.html

https://gitlab.xfce.org/apps/xfce4-scre … _type=tags

/* Copy the screenshot to the Clipboard.
* Code is from gnome-screenshooter.
* @screenshot: the screenshot
*/
void
screenshooter_copy_to_clipboard (GdkPixbuf *screenshot)
{
  GtkClipboard *clipboard;

  TRACE ("Adding the image to the clipboard...");

  clipboard =
    gtk_clipboard_get_for_display (gdk_display_get_default(), GDK_SELECTION_CLIPBOARD);

  gtk_clipboard_set_image (clipboard, screenshot);
}

Offline

#13 2024-03-31 13:58:41

seth
Member
Registered: 2012-09-03
Posts: 51,739

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

actions are offered as radio buttons not check boxes so why does the code

The code there (has horrible newline/indention patterns and) checks whether some sd-action flag is set, the settings could translate to that exclusively ie. "sd->action & (CLIPBOARD|SAVE) == CLIPBOARD|SAVE" isn't an expected condition.

Did you test whether you can scrot into xclip?
The problem might be gtk_clipboard_set_image

Offline

#14 2024-03-31 14:48:08

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

Forgot to attach the debug build log. gtk_clipboard_set_image() might fail but its type is void doesn't return anything.

$ src/xfce4-screenshooter -r -c
TRACE[lib/screenshooter-utils.c:194] screenshooter_read_rc_file(): Open the rc file
TRACE[lib/screenshooter-utils.c:200] screenshooter_read_rc_file(): Read the entries
TRACE[lib/screenshooter-utils.c:231] screenshooter_read_rc_file(): Close the rc file
TRACE[lib/screenshooter-utils.c:238] screenshooter_read_rc_file(): Set the values of the struct
TRACE[lib/screenshooter-capture.c:1486] screenshooter_capture_screenshot(): Let the user select the region to screenshot
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:634] cb_button_pressed(): Left button pressed
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-capture.c:779] cb_motion_notify(): Mouse is moving with left button pressed
TRACE[lib/screenshooter-capture.c:571] cb_draw(): Draw event received.
TRACE[lib/screenshooter-utils.c:156] screenshooter_copy_to_clipboard(): Adding the image to the clipboard...
TRACE[lib/screenshooter-utils.c:487] screenshooter_get_filename_for_uri(): Get the folder corresponding to the URI
DBG[lib/screenshooter-utils.c:100] get_datetime(): datetime is 2024-03-31_06-59-46
TRACE[src/main.c:133] cb_finalize(): Execute finalize callback
TRACE[lib/screenshooter-utils.c:280] screenshooter_write_rc_file(): Open the rc file
TRACE[lib/screenshooter-utils.c:286] screenshooter_write_rc_file(): Write the entries.
TRACE[lib/screenshooter-utils.c:316] screenshooter_write_rc_file(): Flush and close the rc file
TRACE[src/main.c:364] main(): Ciao

scrot works.
screenshooter also works just the clipboard part fails.

$ scrot -F - | xclip -i
$ xclip -o > /tmp/test.png
$ file /tmp/test.png 
/tmp/test.png: PNG image data, 3840 x 1200, 8-bit/color RGB, non-interlaced

Last edited by pm3840 (2024-03-31 15:00:43)

Offline

#15 2024-03-31 14:55:50

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

xclip doesn't affect clipboard either. only X selections.

Offline

#16 2024-03-31 14:59:39

seth
Member
Registered: 2012-09-03
Posts: 51,739

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

Please use [code][/code] tags, not "quote" tags. Edit your post in this regard.

TRACE[lib/screenshooter-utils.c:156] screenshooter_copy_to_clipboard(): Adding the image to the clipboard...
seth wrote:

The problem might be gtk_clipboard_set_image

But I don't understand why screenshooter drags in xclip if it uses the gtk function.

Is this a regression, ie. has this worked in the past an only fails now?

Edit: "xclip -i -selection clipboard"

Last edited by seth (2024-03-31 15:01:26)

Offline

#17 2024-03-31 15:05:43

toz
Member
Registered: 2011-10-28
Posts: 497

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

seth wrote:

Is this a regression, ie. has this worked in the past an only fails now?

This works for me on my systems, so its not a regression. There is something askew here though as you suggest, maybe with gtk_clipboard_set_image?

Edit: @OP, can you post back:

xfconf-query -c xfce4-panel -lv | grep clipman

Or maybe something with clipman settings?

Last edited by toz (2024-03-31 15:09:13)

Offline

#18 2024-03-31 15:09:51

seth
Member
Registered: 2012-09-03
Posts: 51,739

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

You're also running clipman on xfce?

Offline

#19 2024-03-31 15:14:06

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

clipman still doesn't pick up

$ scrot -F - | xclip -i -selection clipboard
$ xclip -o -selection clipboard > /tmp/test.png
$ file /tmp/test.png
/tmp/test.png: PNG image data, 3840 x 1200, 8-bit/color RGB, non-interlaced
$ xfconf-query -c xfce4-panel -lv | grep clipman
/plugins/clipman/tweaks/inhibit                     false
/plugins/plugin-20                                  xfce4-clipman-plugin

Offline

#20 2024-03-31 15:18:11

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

I'm a new user to xfce wouldn't know if this worked before.

Funny xclip doesn't always complain about bad options:

$ scrot -F - | xclip -i --selection clipboard
xclip: --selection: No such file or directory
$ xclip -o --selection clipboard > /tmp/test.png
$ file /tmp/test.png
/tmp/test.png: ASCII text, with no line terminators
$ xclip -o -selection clipboard > /tmp/test.png
$ file /tmp/test.png
/tmp/test.png: PNG image data, 3840 x 1200, 8-bit/color RGB, non-interlaced
$

Offline

#21 2024-03-31 15:22:07

seth
Member
Registered: 2012-09-03
Posts: 51,739

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

"--selection" is simply wrong, it doens't use the gnu doubledash syntax.
If you quit/kill clipman, does screenshooter work as expected?

Offline

#22 2024-03-31 15:27:04

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

Yeah but it doesn't complain when -o is used

Same. Clipboard is not updated.

$ ps ax | grep clip
 354079 pts/8    S+     0:00 grep --color=auto clip
$ xfce4-screenshooter -f -c
$
seth wrote:

"--selection" is simply wrong, it doens't use the gnu doubledash syntax.
If you quit/kill clipman, does screenshooter work as expected?

Offline

#23 2024-03-31 15:52:13

lambdarch
Member
Registered: 2021-01-10
Posts: 75

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

@toz You probably have "Remember last copied image" enabled in clipman history?
With this option unchecked I can reproduce the issue.
I think it's this one: https://gitlab.xfce.org/xfce/libxfce4ui/-/issues/105

Offline

#24 2024-03-31 16:15:01

pm3840
Member
Registered: 2013-12-16
Posts: 61

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

Yes I have this enabled "Remember last copied image" and at least Chromium "Copy image" works.
If this is not enabled, Chromium "Copy image" also fails.

Offline

#25 2024-03-31 16:30:21

lambdarch
Member
Registered: 2021-01-10
Posts: 75

Re: [SOLVED] xfce4 screenshot cannot be saved to clipboard

It always works for me with this option enabled, not sure what happens then.

Offline

Board footer

Powered by FluxBB