From c3646a7642fea6764a5e7f9c6a70e6a8e33a4287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 21 Apr 2020 16:13:20 +0200 Subject: [PATCH] js/main: Inhibit remote access when depending on session mode The session mode determines whether the screen casting should work or not, but until now only dealt with the built in screen cast, not the ones using PipeWire. Add the newly added API for inhibiting remote access when the session mode says screencasts are not allowed. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210 --- js/ui/main.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/js/ui/main.js b/js/ui/main.js index bdd93ae1b..2d7a48019 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -97,6 +97,8 @@ let _oskResource = null; Gio._promisify(Gio._LocalFilePrototype, 'delete_async', 'delete_finish'); Gio._promisify(Gio._LocalFilePrototype, 'touch_async', 'touch_finish'); +let _remoteAccessInhibited = false; + function _sessionUpdated() { if (sessionMode.isPrimary) _loadDefaultStylesheet(); @@ -121,6 +123,17 @@ function _sessionUpdated() { if (lookingGlass) lookingGlass.close(); } + + let remoteAccessController = global.backend.get_remote_access_controller(); + if (remoteAccessController) { + if (sessionMode.allowScreencast && _remoteAccessInhibited) { + remoteAccessController.uninhibit_remote_access(); + _remoteAccessInhibited = false; + } else if (!sessionMode.allowScreencast && !_remoteAccessInhibited) { + remoteAccessController.inhibit_remote_access(); + _remoteAccessInhibited = true; + } + } } function start() {