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>
This commit is contained in:
Ivan Molodetskikh 2022-01-15 19:07:15 +03:00 committed by Marge Bot
parent b757f165a3
commit a9fbee05b1
3 changed files with 24 additions and 0 deletions

View File

@ -14,4 +14,7 @@
<KeyListEntry name="screenshot-window" <KeyListEntry name="screenshot-window"
description="Take a screenshot of a window"/> description="Take a screenshot of a window"/>
<KeyListEntry name="show-screen-recording-ui"
description="Record a screencast interactively"/>
</KeyListEntries> </KeyListEntries>

View File

@ -234,6 +234,10 @@
<default>["Print"]</default> <default>["Print"]</default>
<summary>Take a screenshot interactively</summary> <summary>Take a screenshot interactively</summary>
</key> </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"> <key name="screenshot-window" type="as">
<default>["&lt;Alt&gt;Print"]</default> <default>["&lt;Alt&gt;Print"]</default>
<summary>Take a screenshot of a window</summary> <summary>Take a screenshot of a window</summary>

View File

@ -1297,6 +1297,14 @@ var ScreenshotUI = GObject.registerClass({
showScreenshotUI 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( Main.wm.addKeybinding(
'screenshot-window', 'screenshot-window',
new Gio.Settings({ schema_id: 'org.gnome.shell.keybindings' }), 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 { var ScreenshotService = class {
constructor() { constructor() {
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreenshotIface, this); this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreenshotIface, this);