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




commit 263fe9d28b970aff325714bad44d57140de02891
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.

 data/50-gnome-shell-screenshots.xml |  3 +++
 data/org.gnome.shell.gschema.xml.in |  4 ++++
 js/ui/screenshot.js                 | 22 ++++++++++++++++++++++
 3 files changed, 29 insertions(+)
---
diff --git a/data/50-gnome-shell-screenshots.xml b/data/50-gnome-shell-screenshots.xml
index bc73c67366..0dd251c25d 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="Show the screen recording UI"/>
+
 </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 031f959258..17aca8eba7 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>Show screenshot UI</summary>
     </key>
+    <key name="show-screen-recording-ui" type="as">
+      <default>["&lt;Ctrl&gt;&lt;Shift&gt;&lt;Alt&gt;R"]</default>
+      <summary>Show screen recording UI</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 65fe1f64e5..566e5be7fe 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -1271,6 +1271,18 @@ class ScreenshotUI extends St.Widget {
             showScreenshotUI
         );
 
+        Main.wm.addKeybinding(
+            'show-screen-recording-ui',
+            new Gio.Settings({ schema_id: 'org.gnome.shell.keybindings' }),
+            Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
+            Shell.ActionMode.NORMAL |
+            Shell.ActionMode.OVERVIEW |
+            Shell.ActionMode.SYSTEM_MODAL |
+            Shell.ActionMode.LOOKING_GLASS |
+            Shell.ActionMode.POPUP,
+            showScreenRecordingUI
+        );
+
         Main.wm.addKeybinding(
             'screenshot-window',
             new Gio.Settings({ schema_id: 'org.gnome.shell.keybindings' }),
@@ -2099,6 +2111,16 @@ function showScreenshotUI() {
     });
 }
 
+/**
+ * Shows the screen recording UI.
+ */
+function showScreenRecordingUI() {
+    Main.screenshotUI._castButton.checked = true;
+    Main.screenshotUI.open().catch(err => {
+        logError(err, 'Error opening the screenshot UI');
+    });
+}
+
 /**
  * Takes a screenshot of the currently focused window.
  *


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