From 521525948eed85cc27c0796a0b9569d161df81ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 7 Sep 2023 17:59:03 +0200 Subject: [PATCH 1/2] screenshot: Do not wrongly enable window button The window button is disabled when - there are no windows - we are in screen-recording mode - the session mode doesn't allow windows However the last condition is only taken into account when opening the dialog, but not when switching from recording- to screenshot mode. Address this by updating the button's sensitivity in a separate function, so the different conditions are considered consistently. Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6990 Part-of: --- js/ui/screenshot.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) Index: gnome-shell-44.1/js/ui/screenshot.js =================================================================== --- gnome-shell-44.1.orig/js/ui/screenshot.js +++ gnome-shell-44.1/js/ui/screenshot.js @@ -1377,6 +1377,16 @@ var ScreenshotUI = GObject.registerClass this._castButton.reactive = Main.sessionMode.allowScreencast; } + _syncWindowButtonSensitivity() { + const windows = + this._windowSelectors.flatMap(selector => selector.windows()); + + this._windowButton.reactive = + Main.sessionMode.hasWindows && + windows.length > 0 && + !this._castButton.checked; + } + _refreshButtonLayout() { const buttonLayout = Meta.prefs_get_button_layout(); @@ -1493,10 +1503,7 @@ var ScreenshotUI = GObject.registerClass }); } - this._windowButton.reactive = - Main.sessionMode.hasWindows && - windows.length > 0 && - !this._castButton.checked; + this._syncWindowButtonSensitivity(); if (!this._windowButton.reactive) this._selectionButton.checked = true; @@ -1739,9 +1746,7 @@ var ScreenshotUI = GObject.registerClass this._captureButton.remove_style_pseudo_class('cast'); - const windows = - this._windowSelectors.flatMap(selector => selector.windows()); - this._windowButton.reactive = windows.length > 0; + this._syncWindowButtonSensitivity(); } }