Skip to content

Screenshot: shortcuts with Ctrl save to clipboard only

fixes: #5208

New screenshot UI in Gnome 42 brought unfortunately a regression of user being unable to save the screenshot to a clipboard in any way, which is major annoyance for those whose main use of screenshots in Gnome is (area) screenshot followed by paste to a document or website.

I never hacked on Gnome nor in JavaScript and I know that UI would need more thorough design. This change tries to fix the regression in a minimalist way that leaves options open for later comprehensive rework: it reintroduces Ctrl-PrintScreen and Ctrl-Alt-PrintScreen shortcuts for whole screen and window screenshots to clipboard respectively and in screenshot UI, it assigns Ctrl-C, Ctrl-Enter and Ctrl-Space shortcuts for saving to clipboard only while leaving Enter and Space to current behaviour of saving to both clipboard and file.

In ideal world, Ctrl+click on Capture button would also produce clipboard-only screenshot but based on [1], it seems that that is not possible yet.

In order to achieve this functionality, I introduced boolean clipboardOnly parameter to functions that are invoked when saving the screenshot. This value then gets ORed with value of 'disable-save-to-disk' gsettings key in 'org.gnome.desktop.lockdown' schema so when some of Ctrl-something variants are used, the resulting behaviour is the same as with 'disable-save-to-disk' set to True.

[1] https://discourse.gnome.org/t/how-to-bind-modifier-mousebutton-in-gjs/3743/2

Edited by David Jaša

Merge request reports