thenaterhood / gscreenshot

A simple graphical frontend for multiple screenshot backends including scrot, imagemagick, PIL, imlib2, and grim.
62 stars 6 forks source link

KDE Wayland selection issue #177

Closed KrisAphalon closed 6 months ago

KrisAphalon commented 11 months ago

I have a weird issue on Wayland. When running gscreenshot from the terminal, everything works as expected*. But when I run it without the terminal and selecting "Take screenshot of selection" option, it hides the program but doesn't give me the selection tool to choose which part of the screen I want. I think it then times out after 60 seconds or something and returns with the full-screen screenshot. That makes making selection screenshots impossible.

I'm running:

KrisAphalon commented 11 months ago

I created a pull request with a fix for it. I also found out why I have the screenshots of the selection tool on my machine: I have window close animation in my desktop manager and gscreenshot makes screenshots too fast, so it catches the selection tool closing. I'm not sure if it's possible to somehow mitigate that.

thenaterhood commented 11 months ago

Github has decided I no longer want email notifications, apparently. Didn't see the issue, didn't see the PR. Good thing I looked :)

Thanks for looking into this, that's a weird one and a great catch. The window close animation is an issue I have seen catch the gscreenshot window too and there is some code that tries to prevent it that seems to usually work. Gscreenshot might need something similar when it takes a screenshot after getting a selection.

thenaterhood commented 10 months ago

I can reproduce the selection tool getting caught in the screenshot. There are a couple of issues open on slurp that sound pretty similar with slurp getting caught in screenshots due to a desktop environment's closing animation. The problem appears to be that slurp finishes and exits cleanly, but the window closing animation finishes after slurp has exited and gscreenshot doesn't have any way of knowing when the animation is done.

Interestingly, I notice that the slop region selection tool (which works on a Wayland KDE session in my setup) isn't subject to the same problem and somehow exits without a closing animation. I don't know if slop works universally under Wayland or if there's something special in KDE or my setup that allows it to work, but it would be super easy to update gscreenshot and allow using slop on a Wayland session.

thenaterhood commented 7 months ago

I have what I'm hoping should help with this in https://github.com/thenaterhood/gscreenshot/pull/181, feel free to try it out.

I added a small delay between grabbing the wayland selection area and taking the screenshot, and also changed the region selection color to be more transparent so if it does get into the screenshot it should be a little less disruptive.

thenaterhood commented 6 months ago

Marking this as fixed, as I've released some Wayland improvements. Feel free to re-open if it's still an issue.