-
Notifications
You must be signed in to change notification settings - Fork 84
Fails when application has control over cursor #1
Comments
It is indeed Maybe xdotool could unfocus the currently active window? Another option might be to free the mouse. I'm unsure how to do that that though. For a dirty quick fix you could add a line before scrot to open (and close) a program that takes the focus. |
That's exactly what I want to do. Minecraft specifically will bring up the pause screen when lost focus, which I have disabled in the config. So if the script can make the cursor loose focus from minecraft before it runs |
I "solved" it. So, scrot has an I went ahead and did a copy of Problem is, I have to have 2 scripts. Is there a way to integrate this into the script? Can the script see if the mouse cursor is avaible? Maybe, if the Just a note: the scrot version I had (scrot 0.8-6) did not have this feature, so I installed scrot-patched 0.8-13 which had the feature and it works great. |
You can still do this: if ! $(scrot -s); then That will try to use -s and if that fails it will use -u. When that fails, too, we have an error. |
Thanks! I ended up doing this and it worked like intended! if ! scrot -s "$img" #takes a screenshot with selection
then
if ! scrot -u "$img"
then
echo "Error for image '$img'! Try increasing the sleep time. For more information visit https://github.com/JonApps/imgur-screenshot#troubleshooting" >> "$log"
echo "Something went wrong."
notify-send -a ImgurScreenshot -u critical -c "im.error" -i "$ico" -t 500 "Something went wrong :(" "Information logged to $log"
exit 1
fi
fi |
👍 |
FYI: this is in the new version. |
if ! (scrot -s "$1" &>/dev/null || screencapture -s "$1" &>/dev/null); then #takes a screenshot with selection
echo "Couldn't make selective shot (mouse trapped?). Tryinig to grab active window instead"
if ! (scrot -s "$1" &>/dev/null || screencapture -oWa "$1" &>/dev/null); then
echo "Error for image '$1'! For more information visit https://github.com/JonApps/imgur-screenshot#troubleshooting" >> "$log_file"
echo "Something went wrong. Check the log."
notify error "Something went wrong :(" "Information logged to $log_file"
exit 1
fi
fi Shouldn't the 3rd line say |
It should. Was a bit tired when i pushed ;) |
When true, will open the full screenshot in specified editor after a selective screenshot failed That's all I can do, all other needs to be fixed by the scrot authors.
This script works fine, except when the cursor is occupied by another application or similar.
Basically, when I have a game like Minecraft open, Minecraft is using the cursor. When I run this script from a hotkey, scrot(?) cannot get a hold of the cursor so it fails. The cursor has to be free, as if I were to pause the game.
Opening a terminal first makes minecraft loose focus and I get my cursor, which works, but I'd rather have it bind to a key.
Is there a way for the script to make what is having the mouse occupied to free the cursor? Or is there some other way I can fix this?
The text was updated successfully, but these errors were encountered: