moverest/sway-interactive-screenshot

Freeze the screen when taking a screenshot

Opened this issue · 5 comments

I don't know how hard it is to do that because I know next to nothing about wayland but it would be cool if when selecting the region of the screen it would freeze on whatever image it was displaying at the time I pushed the print button.

Maybe taking a temporary screenshot and displaying on top waiting for the user to make a choice and then either saving the screenshot to the directory or something. It would have to work with several screens too

That is something that I would like to see at some point as well.

I think that that you are right and the way to go would be to create a capture upon pressing the Print key and having the image shown when doing a region selection. However there are these issues:

  • If you have high resolution displays, grim can be pretty slow when making the capture (on my setup it's taking a second to create the capture). As it stands, it doesn't make for a good experience here unfortunately. There might be some optimization that could help but I haven't looked into it.
  • I don't know any Wayland tool that would display an image on top. It's definitely possible to do that with the wlr-layer-shell-unstable-v1 protocol, however this is beyond the scope of a simple helper script. This could be a separate project which it would integrate.

All this considered, we maybe able to solve both issues by scrapping the helper script and go for a program that directly talks to the Wayland compositor to capture the screen. This way we would not have all the overhead of creating a image and then reloading it. I did make the move to a simple Bash script to a more sophisticated Python script, hence I am not ruling out this option for the future even if it's not something I'm planning to start working on soon.

grimblast recently added freeze support with the --freeze option.
It also needs hyprpicker for this to work which is not in the dependencies

I have some errors when using it on my machine though, I think I'll create an issue there about it

Edit : (well grimblast is just a bash script actually, so there's merit to just take the method they used )

Interesting indeed. They use the fact that hyprpicker will "freeze" the screen by getting a frame upon lunch and display it on top of the screen (with the wlr-layer-shell-unstable-v1 protocol). That's neat.

If you want to implement this here, feel free to make an MR, I'll be happy to merge if it works. I'd make hyprpicker an optional dependency.

Yep started looking into that, but yeah it doesn't seem to work exactly the same way in sway and I don't know why. I'll make a MR if I ever find a solution