screenshot-ui: Add two key bindings from g-s-d

These two are moving into gnome-shell to unify screenshot handling and
allow for same-frame capturing.

While we're at it, move the keybindings .xml file from g-c-c here
because it belongs to gnome-shell.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2107>
This commit is contained in:
Ivan Molodetskikh
2022-01-15 19:06:49 +03:00
committed by Marge Bot
parent 414592acf9
commit b0ebbb00b8
5 changed files with 64 additions and 1 deletions

View File

@ -1288,6 +1288,42 @@ var ScreenshotUI = GObject.registerClass({
uiModes,
showScreenshotUI
);
Main.wm.addKeybinding(
'screenshot-window',
new Gio.Settings({ schema_id: 'org.gnome.shell.keybindings' }),
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT | Meta.KeyBindingFlags.PER_WINDOW,
uiModes,
async (_display, window, _binding) => {
try {
const actor = window.get_compositor_private();
const content = actor.paint_to_content(null);
const texture = content.get_texture();
await captureScreenshot(texture, null, 1, null);
} catch (e) {
logError(e, 'Error capturing screenshot');
}
}
);
Main.wm.addKeybinding(
'screenshot',
new Gio.Settings({ schema_id: 'org.gnome.shell.keybindings' }),
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
uiModes,
async () => {
try {
const shooter = new Shell.Screenshot();
const [content] = await shooter.to_content();
const texture = content.get_texture();
await captureScreenshot(texture, null, 1, null);
} catch (e) {
logError(e, 'Error capturing screenshot');
}
}
);
}
_refreshButtonLayout() {