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

Very inconsistent results with specific monitor #180

Closed
raku-cat opened this issue Jun 3, 2019 · 19 comments
Closed

Very inconsistent results with specific monitor #180

raku-cat opened this issue Jun 3, 2019 · 19 comments

Comments

@raku-cat
Copy link
Contributor

raku-cat commented Jun 3, 2019

I've been having an issue for a while that i've just recently pinned down.

I use maim daily to take screenshots, the command I usually use is maim -s -u -b 3 -p -1 $1 /dev/stdout | xclip -selection clipboard -t image/png
My current setup is three monitors, I have one 1600x900, and two 1920x1080 monitors, though the middle one is physically bigger than the second 1080p monitor.

The issue I'm having is basically that I can't consistently take screenshots of anything on the middle (physically largest, 1080p) monitor. It usually just fails and clears the paste buffer.
From what I've found

  • selecting a region instead of doing the auto window select seems to succeed more
  • it works almost every time if I capture a solid color image( for example a blank terminal)

I usually get no error output, and when I run maim manually (not piping anywhere) it either works, and prints out a result to my terminal or will sit there and the command will never complete.
In addition to this, sometimes when I try by using the aforementioned command earlier in this post, it will sometimes print out

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  18 (X_ChangeProperty)
  Resource id in failed request:  0x2e002c2
  Serial number of failed request:  19
  Current serial number in output stream:  19

Other times it will complete silently but I will end up with an empty paste buffer.
I at first thought I was having an issue somewhat similar to #100 in that maybe my quality was simply too high and that taking screenshot from that monitor just took too long to process, and got some semi-consistent results in being able to: take a screenshot, wait a few seconds longer than usual, and then be able to paste that screenshot, but that no longer really works. I've also tried lowering the quality to no avail.
To add to the confusion, sometimes it works fine, literally within seconds of itself, I can try to screenshot a window, have it not work, then have it work fine if I just try enough times.

Sorry this issue is mostly just explanations of specific behaviors I'm getting that I'm sure you won't be able to reproduce, I'd be more than happy to debug this further if there's a way to make maim more verbose.

@raku-cat
Copy link
Contributor Author

raku-cat commented Jun 4, 2019

(second issue in a row as of late that I ended up having incorrect info on after I really started testing thing)
Turns out this occurs on my OTHER 1080p monitor too, I just generally make smaller snippets from that screen so I don't notice the issue as much, whereas my larger screen I mostly play games on and am usually taking fullscreen screenshots on.

@naelstrof
Copy link
Owner

I noticed you're outputting to /dev/stdout, which version of maim are you on?

@raku-cat
Copy link
Contributor Author

raku-cat commented Jun 4, 2019

Version 5.5.3, I don't remember where I got the command from exactly.

@naelstrof
Copy link
Owner

Oh then I have no idea why this is being caused :/.
Make sure you've got and have an updated xrandr as that's used to get the monitor locations and sizes.
The relevant code snippet is probably around here: https://github.com/naelstrof/maim/blob/master/src/image.cpp#L228

I don't know what I should do to fix your problem, all my test cases work.

@raku-cat
Copy link
Contributor Author

raku-cat commented Jun 5, 2019

Is it possible you could make a branch which is more verbose?

@naelstrof
Copy link
Owner

I'm not planning on it. I don't really use Linux as much as I used to and I don't get paid for this. Sorry!

@raku-cat
Copy link
Contributor Author

raku-cat commented Jun 5, 2019

I understand, I'll see if I can figure anything out by my own testings.

@naelstrof
Copy link
Owner

Feel free to ask questions, I still mostly understand how it all works.

@creikey
Copy link

creikey commented Dec 10, 2019

I am also experiencing this issue right now

@foxpy
Copy link
Collaborator

foxpy commented Jan 4, 2020

X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 18 (X_ChangeProperty)
Resource id in failed request: 0x2e002c2
Serial number of failed request: 19
Current serial number in output stream: 19

This is actually not an issue of maim. xclip prints this error message. Makes me very nervous day-to-day.

@foxpy
Copy link
Collaborator

foxpy commented Jan 4, 2020

I would love to know if there is any drop-in replacement for xclip. Thanks!

@foxpy
Copy link
Collaborator

foxpy commented Feb 13, 2020

X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 18 (X_ChangeProperty)
Resource id in failed request: 0x2e002c2
Serial number of failed request: 19
Current serial number in output stream: 19

Hey, @raku-cat, do you get this particular error exactly in the moment of pasting the image into application? For me, xclip works great whenever I paste image to Firefox, GIMP, but when I paste it into Telegram Desktop xclip crashes. So I believe the issue is not with maim or xclip but with application the image is being pasted into.

@foxpy
Copy link
Collaborator

foxpy commented Feb 13, 2020

Also I am almost certainly sure the developers of maim can close this issue now.

@raku-cat
Copy link
Contributor Author

Hey, @raku-cat, do you get this particular error exactly in the moment of pasting the image into application? For me, xclip works great whenever I paste image to Firefox, GIMP, but when I paste it into Telegram Desktop xclip crashes. So I believe the issue is not with maim or xclip but with application the image is being pasted into.

Very sorry I vanished, that's actually exactly how it happens for me down to the app (telegram desktop) lol.
It seems like xclip can take a while to "load in" all the data and if I paste before it's done that's when the error pops up, I'd have to agree with your assessment though that this probably has nothing to do with maim really.

@foxpy
Copy link
Collaborator

foxpy commented Nov 22, 2020

telegram desktop

There was some work on it here: telegramdesktop/tdesktop#5730

Apparently, there is an issue with Qt Clipboard implementation. Whatever I paste into Qt applications, they have a chance to freeze. VirtualBox always crashes when pasting images.

There is a bug report, still unresolved: https://bugreports.qt.io/browse/QTBUG-56595

@foxpy
Copy link
Collaborator

foxpy commented Nov 22, 2020

It seems like xclip can take a while to "load in" all the data and if I paste before it's done that's when the error pops up

Does issue reproduce even after waiting reasonable time for image to "load" into xclip? For me, time did not ever matter at all, that's why I am asking.

@raku-cat
Copy link
Contributor Author

raku-cat commented Nov 22, 2020

It seems like xclip can take a while to "load in" all the data and if I paste before it's done that's when the error pops up

Does issue reproduce even after waiting reasonable time for image to "load" into xclip? For me, time did not ever matter at all, that's why I am asking.

Quite honestly I've been using windows the past few months due to my VR headset, and I haven't been using my computer much for the past few months in general due to business with work, from what I can remember though it did in some cases work if I waited some time, I mention this in my original report:

I at first thought I was having an issue somewhat similar to #100 in that maybe my quality was simply too high and that taking screenshot from that monitor just took too long to process, and got some semi-consistent results in being able to: take a screenshot, wait a few seconds longer than usual, and then be able to paste that screenshot, but that no longer really works. I've also tried lowering the quality to no avail.
To add to the confusion, sometimes it works fine, literally within seconds of itself, I can try to screenshot a window, have it not work, then have it work fine if I just try enough times.

I'll test some more and let you know what I find ;)

@foxpy
Copy link
Collaborator

foxpy commented Nov 22, 2020

I'll test some more

I belive maim is working as intended and the issues are bound not to maim itself, but to overall poor clipboard tooling available. maim is just a tool which outputs image to file/stdout, that's it. To do proper testing on maim itself, please, measure execution time of maim, for example:

; /usr/bin/time maim --quality 10 >/dev/null
0.11user 0.00system 0:00.12elapsed 96%CPU (0avgtext+0avgdata 16088maxresident)k
0inputs+0outputs (0major+3558minor)pagefaults 0swaps
; /usr/bin/time maim --quality 1 >/dev/null
0.06user 0.00system 0:00.07elapsed 92%CPU (0avgtext+0avgdata 16040maxresident)k
0inputs+0outputs (0major+3538minor)pagefaults 0swaps
;

@raku-cat
Copy link
Contributor Author

I'll test some more

I belive maim is working as intended and the issues are bound not to maim itself, but to overall poor clipboard tooling available. maim is just a tool which outputs image to file/stdout, that's it. To do proper testing on maim itself, please, measure execution time of maim, for example:

; /usr/bin/time maim --quality 10 >/dev/null
0.11user 0.00system 0:00.12elapsed 96%CPU (0avgtext+0avgdata 16088maxresident)k
0inputs+0outputs (0major+3558minor)pagefaults 0swaps
; /usr/bin/time maim --quality 1 >/dev/null
0.06user 0.00system 0:00.07elapsed 92%CPU (0avgtext+0avgdata 16040maxresident)k
0inputs+0outputs (0major+3538minor)pagefaults 0swaps
;

I completely agree, I think this issue is completely unrelated to maim, it just comes off that way on a surface level observation, just from quick tests it seems as far as with telegram desktop (my main "testing bench" for this), the issue looks to be fixed, which is good enough for me :P Thanks for taking the time to look in to this, I would have never nailed it down to a bug in QT in a million years

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