maim icon indicating copy to clipboard operation
maim copied to clipboard

maim doesn't pipe output to xclip

Open iyefrat opened this issue 5 years ago • 10 comments
trafficstars

There is the following consolation of facts: OS: Arch Linux maim version: 5.6.3

The following command does copy the image to the clipboard: maim -s | xclip -sel clip -t image/png however, this one doesn't: maim | xclip -sel clip -t image/png

weirdly, this command does infact work: maim > test.png

I had a friend try this out on ubuntu, with maim version 5.5, and all the commands worked for him. We are both running xclip version 0.13.

Any help would be appreciated!

iyefrat avatar May 04 '20 19:05 iyefrat

@souravdas142 you seem to have also had this issue in #202 , but you closed it. Did you manage to figure out what the problem was?

iyefrat avatar May 04 '20 19:05 iyefrat

Do you have any error logs? Which window manager/desktop environment are you using?

Maim could fail to grab the screen under certain situations, for example i3 has an issue of grabbing full control of the keyboard when maim tries to launch from a keybind.

You might need to try adding the --nokeyboard option so that maim doesn't try to grab an ungrabbable keyboard, though a plain call to maim shouldn't grab the keyboard unless I made a mistake somewhere :/.

naelstrof avatar May 04 '20 20:05 naelstrof

When running it from the command line I get no errors. I'm not sure where else I should look for error logs.

I'm using bspwm (arch repo says 0.9.9 but bspwm -v says 0.9.7-10-g2ffd9c1, but this is probably not very relevant).

This error happens when I run it from the terminal, and passing --nokeyboard does not make a difference.

iyefrat avatar May 04 '20 20:05 iyefrat

Could you check your journalctl for errors from maim? You could also try piping the stderr output to terminal. (Just add 2>&1 to the end of the failing command).

naelstrof avatar May 04 '20 20:05 naelstrof

maim | xclip -sel clip -t image/png 2>&1, maim 2>&1 | xclip -sel clip -t image/png, and maim 2>&1 | xclip -sel clip -t image/png 2>&1 did not give any output. journalctl only has messages from a few minutes before I try the command, and does not update after I try it.

iyefrat avatar May 04 '20 21:05 iyefrat

Without an error I'm unsure what to do. I remember bspwm doing some really esoteric stuff which required workarounds for maim, though bspwm is one of the managers I did make sure maim worked on.

Maybe X11 is outputting errors to stdout? Gotta figure out what error you're encountering or I can't really say what's wrong.

naelstrof avatar May 05 '20 00:05 naelstrof

Unfortunately I'm not sure where too look for X11 errors. I've tried to look this up online but didn't really get anywhere. However, I'm not sure that is where the error would be. maim image.png does work and save an image, which xclip then cannot copy if we try directly with xclip -sel clip -t image/png -i image.png. This however does work with the -s option. I don't know C++ so I haven't really gotten anywhere trying to check myself, but is there a difference in the way that maim and maim -s create the picture? This might be some weird xclip bug where it can't process some pictures for some reason

iyefrat avatar May 08 '20 09:05 iyefrat

@souravdas142 you seem to have also had this issue in #202 , but you closed it. Did you manage to figure out what the problem was?

@itai33 Yes. Problem is with my clipboard manager "CopyQ" (CopyQ-Issue) see this.

souravdas142 avatar May 08 '20 11:05 souravdas142

I've been having the same issue but it only started today. maim -su -m 1 | xclip -selection clipboard -t image/png will run then stop right after you run it. Before it would let you select an area but now it doesn't. I tried the same commands as provided above but came to the same conclusion. Ironically I'm on Arch Linux too so maybe there is a link? Not sure.

Edit: Turns out maim segfaults when you try and run it

$ maim -s test.png
Segmentation fault (core dumped)

redshifttt avatar May 15 '20 18:05 redshifttt

I've been having the same issue but it only started today. maim -su -m 1 | xclip -selection clipboard -t image/png will run then stop right after you run it. Before it would let you select an area but now it doesn't. I tried the same commands as provided above but came to the same conclusion. Ironically I'm on Arch Linux too so maybe there is a link? Not sure.

Edit: Turns out maim segfaults when you try and run it

$ maim -s test.png
Segmentation fault (core dumped)

Could you run it through valgrind? You might have to compile maim with debug symbols in order for valgrind to give a good output. valgrind maim -s test should give me what I need.

naelstrof avatar May 16 '20 11:05 naelstrof