From b365eb99366f73c7bf16e260076033ae9072a63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 27 Apr 2022 15:33:40 +0200 Subject: [PATCH] screenshot: Hide screencast button when recorder is disabled The screencast D-Bus service that is used for the recordings is only installed if the necessary gstreamer and pipewire dependencies are found at build time. The screencast button cannot work when the service is missing, so don't show it in the first place. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2450 Part-of: --- js/misc/config.js.in | 2 ++ js/misc/meson.build | 1 + js/ui/screenshot.js | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/js/misc/config.js.in b/js/misc/config.js.in index 776a6c600..8cea70bc0 100644 --- a/js/misc/config.js.in +++ b/js/misc/config.js.in @@ -10,6 +10,8 @@ var HAVE_BLUETOOTH = @HAVE_BLUETOOTH@; var HAVE_NETWORKMANAGER = @HAVE_NETWORKMANAGER@; /* 1 if soup2 should be used instead of soup3, 0 otherwise */ var HAVE_SOUP2 = @HAVE_SOUP2@; +/* 1 if recorder is enabled, 0 otherwise */ +var HAVE_RECORDER = @HAVE_RECORDER@; /* gettext package */ var GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@'; /* locale dir */ diff --git a/js/misc/meson.build b/js/misc/meson.build index 582562711..43d6d99c6 100644 --- a/js/misc/meson.build +++ b/js/misc/meson.build @@ -6,6 +6,7 @@ jsconf.set('LIBMUTTER_API_VERSION', mutter_api_version) jsconf.set10('HAVE_BLUETOOTH', bt_dep.found()) jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager) jsconf.set10('HAVE_SOUP2', have_soup2) +jsconf.set10('HAVE_RECORDER', enable_recorder) jsconf.set('datadir', datadir) jsconf.set('libexecdir', libexecdir) diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 63069d216..98cfec468 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -3,6 +3,7 @@ const { Clutter, Cogl, Gio, GObject, GLib, Graphene, Gtk, Meta, Shell, St } = imports.gi; +const Config = imports.misc.config; const GrabHelper = imports.ui.grabHelper; const Layout = imports.ui.layout; const Lightbox = imports.ui.lightbox; @@ -1212,6 +1213,7 @@ var ScreenshotUI = GObject.registerClass({ this._castButton = new St.Button({ style_class: 'screenshot-ui-shot-cast-button', toggle_mode: true, + visible: Config.HAVE_RECORDER, }); this._castButton.set_child(new St.Icon({ icon_name: 'camera-web-symbolic' })); this._castButton.connect('notify::checked', @@ -1429,6 +1431,9 @@ var ScreenshotUI = GObject.registerClass({ if (this._screencastInProgress) return; + if (mode === UIMode.SCREENCAST && !Config.HAVE_RECORDER) + return; + this._castButton.checked = mode === UIMode.SCREENCAST; if (!this.visible) {