status/remote-access: Add menu for stopping screencasts

This is specifically for stopping the screenshot UI screencasts for now.
It's possible to stop arbitrary screen recording handles, however due to
an issue with pipewiresrc, this method cannot currently work for cleanly
stopping Shell's own screen recordings. Hence the best we can do is to
handle just the screenshot UI screencasts to let them stop cleanly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2103>
This commit is contained in:
Ivan Molodetskikh 2021-08-17 10:58:23 +03:00 committed by Marge Bot
parent fc0bff5e48
commit 6d0c2ae697

View File

@ -3,6 +3,7 @@
const { GObject, Meta } = imports.gi;
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
@ -50,6 +51,15 @@ class RemoteAccessApplet extends PanelMenu.SystemIndicator {
this._recordingIndicator = this._addIndicator();
this._recordingIndicator.icon_name = 'media-record-symbolic';
this._recordingIndicator.add_style_class_name('screencast-indicator');
this._recordingItem = new PopupMenu.PopupSubMenuMenuItem(
_('Screen Recording in Progress'),
true
);
this._recordingItem.menu.addAction(_('Stop'),
() => Main.screenshotUI.stopScreencast());
this._recordingItem.icon.icon_name = 'media-record-symbolic';
this.menu.addMenuItem(this._recordingItem);
}
_isScreenShared() {
@ -70,6 +80,7 @@ class RemoteAccessApplet extends PanelMenu.SystemIndicator {
}
this._recordingIndicator.visible = this._isRecording();
this._recordingItem.visible = Main.screenshotUI.screencast_in_progress;
}
_onStopped(handle) {