naelstrof / maim

maim (make image) takes screenshots of your desktop. It has options to take only a region, and relies on slop to query for regions. maim is supposed to be an improved scrot.
Other
2.13k stars 78 forks source link

maim doesn't pipe output to xclip #205

Open iyefrat opened 4 years ago

iyefrat commented 4 years ago

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 commented 4 years ago

@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?

naelstrof commented 4 years ago

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 :/.

iyefrat commented 4 years ago

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.

naelstrof commented 4 years ago

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).

iyefrat commented 4 years ago

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.

naelstrof commented 4 years ago

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.

iyefrat commented 4 years ago

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

souravdas142 commented 4 years ago

@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.

redshifttt commented 4 years ago

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)
naelstrof commented 4 years ago

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.