Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

No way of cancelling #11

Closed
Brottweiler opened this issue Apr 28, 2014 · 2 comments
Closed

No way of cancelling #11

Brottweiler opened this issue Apr 28, 2014 · 2 comments

Comments

@Brottweiler
Copy link

If I start to make a selection, there is no way of cancelling it. If I press ESC it does "cancel" it, but it (scrot I guess) instead screenshots the entire window.

I would like pressing ESC, or maybe some assigned key like LCTRL to cancel the upload. I don't care if scrot actually takes a screenshot, but the script should not upload it.

@jomo
Copy link
Owner

jomo commented Apr 28, 2014

This is due to the workaround for #1.
scrot exits with an error when it does not take a screenshot. This can be due to the mouse being trapped or due to pressing any key while taking the selection.
I'm currently nowhere near a Linux system, so I can currently not test if pressing a key exists with a different code than exiting because the mouse was trapped.
I'll test this later, though.

Currently I the script only checks if scrot ran successfully. If not, it will assume that the mouse was trapped and will then grab the entire window.

Until I can look into this, the best thing you can do is:

edit_on_selection_fail="true"
edit_command="rm %img"

Alternatively you can set the edit command to "exit" or to a valid editor. In that case you could use the time it's opened in the editor to delete the file manually, or if you're lazy, resize the image to 1x1 px.


PS: thanks for sharing this tool on oc.tc :)

@jomo
Copy link
Owner

jomo commented Apr 30, 2014

I did a few tests.
When pressing a key, the return code is 2. However stderr shows:

giblib error: no image grabbed

When the mouse is trapped, the return code is 2 as well, but stderr shows:

giblib error: couldn't grab pointer:Resource temporarily unavailable

Solution would go somewhat like this:
Try to take the screenshot, if that failed, make sure we're using scrot and then check what stderr says.
If stderr matches the first example above, exit.
If it matches the second message, capture the window.
Otherwise, exit with unknown/uncaugth error.

I have a few other plans of more features that require changes anyway, so I'll probably push that along with those.

@jomo jomo closed this as completed in 57c236f May 12, 2014
jomo added a commit that referenced this issue Apr 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants