[gnome-shell] screenshot-ui: Add a key to open the screencast UI



commit a9fbee05b19144c8f685a9e05bfa86aac0b1cb20
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Sat Jan 15 19:07:15 2022 +0300

    screenshot-ui: Add a key to open the screencast UI
    
    It replaces the "record a short screencast" key from g-s-d.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2107>

 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 d99f60bd21..c82f1a3fb3 100644
--- a/data/50-gnome-shell-screenshots.xml
+++ b/data/50-gnome-shell-screenshots.xml
@@ -14,4 +14,7 @@
     <KeyListEntry name="screenshot-window"
                   description="Take a screenshot of a window"/>
 
+    <KeyListEntry name="show-screen-recording-ui"
+                  description="Record a screencast interactively"/>
+
 </KeyListEntries>
\ 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 e686d2203d..d3f3c702d2 100644
--- a/data/org.gnome.shell.gschema.xml.in
+++ b/data/org.gnome.shell.gschema.xml.in
@@ -234,6 +234,10 @@
       <default>["Print"]</default>
       <summary>Take a screenshot interactively</summary>
     </key>
+    <key name="show-screen-recording-ui" type="as">
+      <default>["&lt;Ctrl&gt;&lt;Shift&gt;&lt;Alt&gt;R"]</default>
+      <summary>Record a screencast interactively</summary>
+    </key>
     <key name="screenshot-window" type="as">
       <default>["&lt;Alt&gt;Print"]</default>
       <summary>Take a screenshot of a window</summary>
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index eb9d21a5df..c7ae64949a 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]