Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maim doesn't pipe output to xclip #205

Open
iyefrat opened this issue May 4, 2020 · 10 comments
Open

maim doesn't pipe output to xclip #205

iyefrat opened this issue May 4, 2020 · 10 comments

Comments

@iyefrat
Copy link

iyefrat commented May 4, 2020

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
Copy link
Author

iyefrat commented May 4, 2020

@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
Copy link
Owner

naelstrof commented May 4, 2020

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
Copy link
Author

iyefrat commented May 4, 2020

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
Copy link
Owner

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
Copy link
Author

iyefrat commented May 4, 2020

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
Copy link
Owner

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
Copy link
Author

iyefrat commented May 8, 2020

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
Copy link

souravdas142 commented May 8, 2020

@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
Copy link

redshifttt commented May 15, 2020

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants