Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"area-screenshot," "area-screenshot-clip" do not work, under any keybinding #3981

Closed
wchargin opened this issue Mar 21, 2015 · 38 comments
Closed

Comments

@wchargin
Copy link
Contributor

Since upgrading from 17 Qiana to 17.1 Rebecca (via mintupdate), the ShiftPrintScreen keybinding no longer works for me, nor does ShiftCtrlPrintScreen.

I checked in cinnamon-settings → Keyboard → Keyboard Shortcuts → System → Screenshots and Recording, and the keys are properly bound. If I add another binding for the same operation, it still doesn't work.

Running gnome-screenshot -a from a terminal gives the expected behavior.

I have run cinnamon-desktop-migrate-mediakeys. I don't know if it was working before I did this.

@wchargin
Copy link
Contributor Author

wchargin commented Apr 3, 2015

Any thoughts? I'd be happy to work on a patch if someone could show me where to start. Thanks!

@andreasnuesslein
Copy link

i can confirm this problem.
also i've never run cinnamon-desktop-migrate-mediakeys (knowingly) and still it's not working

@juanluperez
Copy link

Same problem here in a new Linux Mint 17.3 intall.

@juanluperez
Copy link

There's a trick a I do to get it working. I keep Ctrl+Shift+Prnt.Screen pushed for few seconds and when released it works. It works in a good probability.

@wchargin
Copy link
Contributor Author

@juanluperez: whoa, can confirm—that's mind-boggling. any ideas why?

@porpoisepor
Copy link

Stumbled upon this using a fresh Mint 17.3 install too.
This has been described here https://forums.linuxmint.com/viewtopic.php?f=60&t=210288 and also here https://forums.linuxmint.com/viewtopic.php?t=202909

tl;dr:
Two separate workarounds are:
1)

holding Shift and doing a quick tap of the PrtScrn works everytime

  1. Using a script for the ShiftPrtScn shortcut with sleep before running the screenshot command:
#!/bin/sh

sleep 0.125
gnome-screenshot --area

@anandrkris
Copy link

If I hold the keys for a while, I can get it to work.
MATE seems to be affected as well.
mate-desktop/mate-utils#37

@ManIVIctorious
Copy link

I just tried all screenshot/recording shortcuts and they all seem to work for me on Arch Linux with cinnamon 3.0.7 and gnome-screenshot 3.20.1 installed.
Is this still an issue for you with latest cinnamon?

@juanluperez
Copy link

Yes, this is still a problem with new cinnamon. Nothing changes.

@christianbueno1
Copy link

christianbueno1 commented Nov 2, 2016

Hello friends, I just had installed Antergos [Arch Linux]+ Cinnamon , I has to say there is a problem for take area screenshot.
Similar to my friend @anandrkris , I has to hold the keys for a while to take the area screenshot.
cinnamon version: 3.0.7
Linux Kernel: 4.8.6-1ARCH
gnome-screenshot version: 3.22.0
Greetings from Ecuador

@christianbueno1
Copy link

christianbueno1 commented Nov 3, 2016

Thanks to Joriktos.
First let's go to delete the already existing keybinding. Go to

System Settings>Keyboard>Shortcuts

In the left panel select

System>Screenshot and Recording

Click in Take a screenshot of an area, below in Keyboard bindings section double click in Shift+Print and BackSpace for clear the existing keybinding. After that, go below and click

Add custom shortcut

type a name "New_area_shortcut" for example, and in Command area type

sh -c 'sleep 0.125; gnome-screenshot -a'

and after click Add.

OS: Antergos [Arch Linux]
cinnamon version: 3.0.7
Linux Kernel: 4.8.6-1ARCH
gnome-screenshot 3.22.0

@ManIVIctorious
Copy link

I have realized that cinnamon sometimes has to be restarted for new shortcuts to work, could you please retry after a cinnamon restart?

@jerrygreen
Copy link

jerrygreen commented Mar 9, 2017

Almost two years behind and still no fix :{

Btw thanks for a hint with holding

@marga-google
Copy link
Contributor

This is still the case on Debian stretch, running cinnamon 3.2

I can confirm the information that is mentioned in #5263: the problem depends on how long you press the PrtScn key. If you do a very short keypress, it works fine. Doing a longer (normal) keypress, doesn't work.

Looking at .xsession-errors you can see that in the second case (normal length keypress), the screenshot was already triggered, and that the are had width = 0 and height = 0

@marga-google
Copy link
Contributor

I suspect this is actually a long-standing bug in gnome-screenshot. It's been reported for mate-screenshot:
mate-desktop/mate-utils#37

I think this upstream bug is reporting about the same issue, although it doesn't have much info:
https://bugzilla.gnome.org/show_bug.cgi?id=682626

@Deleetdk
Copy link

Deleetdk commented Aug 2, 2017

Long standing bug, still not fixed in Mint 18.2.

Sigh!

@soomtong
Copy link

soomtong commented Sep 1, 2017

I have 3 Mint 18.2 machines.
the 2 of them work well with any print screen key.
but my main desktop does not work as a normal procedure.

anyway there is a bug, we still know another solution.
cheers!

@Marinofull
Copy link

I came here hope for a solution, but I'm in Mint 18.3 and the bug still remains ;(

@smurphos
Copy link
Contributor

I remapped to not use my PrintScr button - Crtl-S - full screen screenshot, Super-S - Current Window. All is well.

@adenbley
Copy link

Mint 19 still has issue. Thanks for the tips though.

@Sraw
Copy link

Sraw commented Aug 28, 2018

I can confirm this is still a bug in Mint 19. Hope it can be solved. I have to double press Print to get it work.

@lucidyan
Copy link

Still a bug in Mint 19

mtwebster added a commit to mtwebster/gnome-screenshot that referenced this issue Oct 11, 2018
screenshot.

If the grab-taking area overlay window gets set up too soon, it seems
to get interfered with by the key event handling that may have spawned
it in the first place (via csd-mediakeys for instance.)

Use g_idle_add at the end of a successful area pick to keep consistency
between the native and fallback area handlers.

ref:
linuxmint/cinnamon#3981
linuxmint/cinnamon-settings-daemon#182
@davmillar
Copy link

Can confirm this also occurs when installing Cinnamon on an existing Fedora 28 machine. It works fine when I log into Gnome 3 instead.

@clefebvre
Copy link
Member

@Sraw
Copy link

Sraw commented Nov 16, 2018

@clefebvre Do you mean update gnome-screenshot to 3.25.0? I've tested it, nothing improved. Still a bug. Sometimes works, sometimes not.

I don't fully understand what happens? It worked perfectly in the past, and after updating to 17.01 or later, it doesn't work any more. So why not just rollback?

@mtwebster
Copy link
Member

Did you try the package he linked? Upstream 3.25 does not contain this fix (it has been submitted but not yet accepted).

As to your other question, most likely nothing changed with gnome-screenshot itself. Hundreds of packages surrounding and being used by gnome-screenshot did. The way gnome-screenshot works it likely ended up being affected by what is more or less behavioral drift by the desktop and other components of the os over the years.

@Sraw
Copy link

Sraw commented Nov 16, 2018

Now I have tried it. Whoa, it works seamlessly. At least for now.

Thank you @mtwebster and @clefebvre .

@altarin
Copy link

altarin commented Jan 9, 2019

Thanks to Joriktos.
First let's go to delete the already existing keybinding. Go to

System Settings>Keyboard>Shortcuts

In the left panel select

System>Screenshot and Recording

Click in Take a screenshot of an area, below in Keyboard bindings section double click in Shift+Print and BackSpace for clear the existing keybinding. After that, go below and click

Add custom shortcut

type a name "New_area_shortcut" for example, and in Command area type

sh -c 'sleep 0.125; gnome-screenshot -a'

and after click Add.

OS: Antergos [Arch Linux]
cinnamon version: 3.0.7
Linux Kernel: 4.8.6-1ARCH
gnome-screenshot 3.22.0

For me works, but with sleep 0.25 Mint 18.3 Cinnamon

@LinuxOnTheDesktop
Copy link

It seems to me that this problem persists. Am I right?

@areographe
Copy link

This problem is still occurring. With the keybinding I was using, pressing ShiftPrtSc would always create a gnome-screenshot process, but 4 out of 5 times the process would just fail to work and then stay sleeping until I ran killall gnome-screenshot. Changing to a custom shortcut with sleep 0.25 beforehand still works, though.

@Deleetdk
Copy link

I will donate 100 USD to whoever submits an accepted pull request solution for this. It's been 5 years now!

@areographe
Copy link

Agreed @Deleetdk, I'm skint at the moment but will definitely throw a few USD towards a solution if one is found. I should just mention, when @juanluperez says:

There's a trick a I do to get it working. I keep Ctrl+Shift+Prnt.Screen pushed for few seconds and when released it works. It works in a good probability.

In my experience, opening htop and then testing the "keep [the key combination] pushed for a few seconds" technique shows that many gnome-screenshot processes appear, the longer the keys are pressed the more identical processes appear, and when the crosshairs finally appear and I select the area and successfully take the screenshot, one gnome-screenshot process disappears, but all the previous ones spawned during holding down the keys remain, again until I run killall gnome-screenshot.

@voleresistor
Copy link

In my experience, opening htop and then testing the "keep [the key combination] pushed for a few seconds" technique shows that many gnome-screenshot processes appear, the longer the keys are pressed the more identical processes appear, and when the crosshairs finally appear and I select the area and successfully take the screenshot, one gnome-screenshot process disappears, but all the previous ones spawned during holding down the keys remain, again until I run killall gnome-screenshot.

+1 more for this. Holding the key opens many instances of gnome-screenshot for me on Fedora 32. These do not exit unless you kill the processes and the buildup seems to eventually prevent the hotkey from working even by using the hold [key combo] "workaround" until you kill them.

The custom shortcut with

sh -c 'sleep 0.125; gnome-screenshot -a'

DOES work on the first keypress every time and doesn't seem to result in spawning multiple additional processes so thank you to whoever initially figured that out.

@mtwebster
Copy link
Member

I'm going to call this tentatively fixed by this:linuxmint/cinnamon-settings-daemon@7daaa5c

We've been patching gnome-screenshot on mint for a while now to work around the issue with area screenshots, but this should allow any version of gnome-screenshot to work properly in Cinnamon.

I had submitted a patch upstream but it was never really looked at, so this is about the next best we can probably do.

@dandv
Copy link
Contributor

dandv commented Jan 3, 2021

I know nothing about Mint's internals. I'm curious why screenshot taking is so complex as to lead to this many bugs?

@LinuxOnTheDesktop
Copy link

I'm going to call this tentatively fixed by this:linuxmint/cinnamon-settings-daemon@7daaa5c

We've been patching gnome-screenshot on mint for a while now to work around the issue with area screenshots, but this should allow any version of gnome-screenshot to work properly in Cinnamon.

I had submitted a patch upstream but it was never really looked at, so this is about the next best we can probably do.

@mtwebster

Might Mint be able to do any better, on this front, for Mint 20.1, please?

@mtwebster
Copy link
Member

I'm pretty satisfied with that fix I linked.

The issue, simplified, is that the mechanism for stretching the rectangle over what you want to take a screenshot of requires a 'grab' of the pointer/keyboard - meaning, it wants to acquire temporary input focus over the rest of the desktop.

However, the way system-wide shortcuts (like the screenshot hotkeys) also take a brief grab of the focus, and it hasn't relinquished that grab yet by the time gnome-screenshot wants it. So gnome-screenshot takes that as failure and aborts. You could sometimes make it work if you tried enough times, you could break thru this 'race' condition.

When we patched gnome-screenshot, we made it attempt to get this grab multiple times until it got it (with a short delay in between attempts). This worked great but it only worked in Mint. The cinnamon-settings-daemon patch addresses this in the same way, it's just done in a spot that will allow the fix to work universally now, on any distro (and we can stop patching a foreign package).

@foxel
Copy link

foxel commented Mar 5, 2021

My slight variation of the fix, maybe usable for those who get there googling for a solution.

put the following into ~/.local/bin/gnome-screenshot

#!/bin/sh

sleep 0.125

LANGUAGE=en /usr/bin/gnome-screenshot $@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests