From a9fbee05b19144c8f685a9e05bfa86aac0b1cb20 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 15 Jan 2022 19:07:15 +0300 Subject: [PATCH] screenshot-ui: Add a key to open the screencast UI It replaces the "record a short screencast" key from g-s-d. Part-of: --- data/50-gnome-shell-screenshots.xml | 3 +++ data/org.gnome.shell.gschema.xml.in | 4 ++++ js/ui/screenshot.js | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/data/50-gnome-shell-screenshots.xml b/data/50-gnome-shell-screenshots.xml index d99f60bd2..c82f1a3fb 100644 --- a/data/50-gnome-shell-screenshots.xml +++ b/data/50-gnome-shell-screenshots.xml @@ -14,4 +14,7 @@ + + \ No newline at end of file diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in index e686d2203..d3f3c702d 100644 --- a/data/org.gnome.shell.gschema.xml.in +++ b/data/org.gnome.shell.gschema.xml.in @@ -234,6 +234,10 @@ ["Print"] Take a screenshot interactively + + ["<Ctrl><Shift><Alt>R"] + Record a screencast interactively + ["<Alt>Print"] Take a screenshot of a window diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index eb9d21a5d..c7ae64949 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -1297,6 +1297,14 @@ var ScreenshotUI = GObject.registerClass({ showScreenshotUI ); + Main.wm.addKeybinding( + 'show-screen-recording-ui', + new Gio.Settings({ schema_id: 'org.gnome.shell.keybindings' }), + Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, + uiModes, + showScreenRecordingUI + ); + Main.wm.addKeybinding( 'screenshot-window', new Gio.Settings({ schema_id: 'org.gnome.shell.keybindings' }), @@ -2187,6 +2195,15 @@ function showScreenshotUI() { }); } +/** + * Shows the screen recording UI. + */ +function showScreenRecordingUI() { + Main.screenshotUI.open(UIMode.SCREENCAST).catch(err => { + logError(err, 'Error opening the screenshot UI'); + }); +} + var ScreenshotService = class { constructor() { this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreenshotIface, this);