contrib icon indicating copy to clipboard operation
contrib copied to clipboard

grimblast : Errors when using --freeze and area

Open Absobel opened this issue 2 years ago • 12 comments

When I try using the --freeze argument with the area option, I get errors, then it freezes without the gray overlay. When I click it freezes on an image half a second later than the first freeze, and if I want to screenshot I have to keep pressing the left click and select the area with the right click.

grimblast check returns all OK.

errors when executing the command :

parse error: Invalid numeric literal at line 1, column 28
parse error: Invalid numeric literal at line 1, column 28
parse error: Invalid numeric literal at line 1, column 28
jq: invalid JSON text passed to --argjson
Use jq --help for help with command-line options,
or see the jq manpage, or online docs  at https://stedolan.github.io/jq

error after taking the screenshot : /usr/bin/grimblast: line 197: kill: (355954) - No such process

Absobel avatar Jun 22 '23 10:06 Absobel

Hmm, kill should be in the coreutils package. Do you not have that installed?

fufexan avatar Jun 22 '23 10:06 fufexan

No I have kill, i think it just doesn't find the process it's supposed to kill

Absobel avatar Jun 22 '23 10:06 Absobel

Hmm, it must be because hyprpicker and slurp are in a race condition. I think slurp starts faster and thus when you press click again, hyprpicker gets killed. So the process that was supposed to be killed exited before the code reached it. You could try adjusting the sleep period on line 179, set it to 0.5 maybe. If it helps, I'll increase it.

fufexan avatar Jun 22 '23 10:06 fufexan

It doesn't work, I went up to sleep 2 but it just delays the problem. Though I found out that if I click right during the sleep period it works correctly (still outputing the same errors though)

Absobel avatar Jun 22 '23 10:06 Absobel

So the jq errors still persist? The only mention of --argjson in the code is for window selection. What is your Hyprland version?

fufexan avatar Jun 22 '23 10:06 fufexan

Ah I forgot to specify that, would have been an interesting information to have, but I don't use Hyprland, I use sway. I was told it would work anyway since both use wlroots

Absobel avatar Jun 22 '23 10:06 Absobel

It does not. It requires hyprctl to get the windows (akin to swaymsg -t get_tree). Since you're not on Hyprland, the command fails and brings the whole script down. The rest of the commands should work though (except area and active).

fufexan avatar Jun 22 '23 10:06 fufexan

Well hyprpickr alone works fine though. At the very least I could make my own screenshot script I think

Absobel avatar Jun 22 '23 10:06 Absobel

Maybe I could check whether HYPRLAND_INSTANCE_SIGNATURE is set before trying to get the windows list.

fufexan avatar Jun 22 '23 10:06 fufexan

I think I'll have more chances trying to implement the same solution with hyprpicker with grimshot I think ? Or at least make my own script with grim and slurp

Absobel avatar Jun 22 '23 10:06 Absobel

Sure, that could work. The commit where I added the --freeze argument is pretty small, so you can use that to adapt grimshot.

fufexan avatar Jun 22 '23 10:06 fufexan

Okay I'll do that thanks !

Absobel avatar Jun 22 '23 10:06 Absobel