From 0fa592a516cf675e1a31df120b638e19c3f2e79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 23 Nov 2023 14:25:57 +0100 Subject: [PATCH 01/11] apps-menu: Adjust to events API changes Part-of: (cherry picked from commit f6a6bdda992cf989859b56aa2fd1cd0a34040f26) --- extensions/apps-menu/extension.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 6eb58f10..1d423906 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -214,9 +214,9 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem { this._grab?.dismiss(); delete this._grab; - let source = event.get_source(); - if (source instanceof St.Widget) - source.sync_hover(); + const targetActor = global.stage.get_event_actor(event); + if (targetActor instanceof St.Widget) + targetActor.sync_hover(); return false; } From ed60502f10edb2937327a7223ef2b6fceecf4add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 23 Nov 2023 21:08:31 +0100 Subject: [PATCH 02/11] apps-menu: Use stylesheet to set width The `style` property is useful for computed CSS declarations, but for regular styling the stylesheet is preferable. Part-of: (cherry picked from commit 8c8f990a286170756a78730d3f45967302d5b830) --- extensions/apps-menu/extension.js | 1 - extensions/apps-menu/stylesheet.css | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 1d423906..93bea2a4 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -590,7 +590,6 @@ class ApplicationsButton extends PanelMenu.Button { _display() { this._applicationsButtons.clear(); - this.mainBox.style = 'width: 35em;'; this.mainBox.hide(); // Load categories diff --git a/extensions/apps-menu/stylesheet.css b/extensions/apps-menu/stylesheet.css index a5aae0b0..16eed17b 100644 --- a/extensions/apps-menu/stylesheet.css +++ b/extensions/apps-menu/stylesheet.css @@ -4,6 +4,8 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +.apps-menu {width: 26em;} + .apps-menu:ltr { padding-right: 3px; } From ed31f08f2f6ed95a3e4a046b085d8bfa7a604e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 23 Nov 2023 15:38:25 +0100 Subject: [PATCH 03/11] apps-menu: Remove vertical separator Ever since gnome-shell stopped using a stippled separator in the calendar menu, the styling required by the separator has been missing. There haven't been any complaints about the invisible separator, so we can just as well drop it altogether. Part-of: (cherry picked from commit c3cbef19ac960deaf0cc8131a4871107bf1d1079) --- extensions/apps-menu/extension.js | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 93bea2a4..a453e6ae 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -432,15 +432,6 @@ class ApplicationsButton extends PanelMenu.Button { } } - _createVertSeparator() { - let separator = new St.DrawingArea({ - style_class: 'calendar-vertical-separator', - pseudo_class: 'highlighted', - }); - separator.connect('repaint', this._onVertSepRepaint.bind(this)); - return separator; - } - _onDestroy() { super._onDestroy(); @@ -462,21 +453,6 @@ class ApplicationsButton extends PanelMenu.Button { return super._onMenuKeyPress(actor, event); } - _onVertSepRepaint(area) { - let cr = area.get_context(); - let themeNode = area.get_theme_node(); - let [width, height] = area.get_surface_size(); - let stippleColor = themeNode.get_color('-stipple-color'); - let stippleWidth = themeNode.get_length('-stipple-width'); - let x = Math.floor(width / 2) + 0.5; - cr.moveTo(x, 0); - cr.lineTo(x, height); - Clutter.cairo_set_source_color(cr, stippleColor); - cr.setDash([1, 3], 1); // Hard-code for now - cr.setLineWidth(stippleWidth); - cr.stroke(); - } - _onOpenStateChanged(menu, open) { if (open) { if (this.reloadFlag) { @@ -583,7 +559,6 @@ class ApplicationsButton extends PanelMenu.Button { this.categoriesScrollBox.add_actor(this.categoriesBox); this.mainBox.add(this.leftBox); - this.mainBox.add_child(this._createVertSeparator()); this.mainBox.add_child(this.applicationsScrollBox); section.actor.add_actor(this.mainBox); } From 6bbc329e7b3647fa94ec5d1c36787584e3ff2612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 23 Nov 2023 20:59:57 +0100 Subject: [PATCH 04/11] apps-menu: Use customized layout manager to limit height To avoid continuous height changes while browsing through categories, we let the list of categories determine the overall height, and rely on scrolling for the list of apps within a category. We currently achieve this by assigning a fixed height via the `style` property. This has been found to trigger a crash when running headless, as we end up querying an actor's height request before a valid resource scale is available. Instead, use a custom layout manager, which seems more elegant anyway. Close: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/472 Part-of: (cherry picked from commit 5652182fb3308110d9b7c8331675831222ebe7e7) --- extensions/apps-menu/extension.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index a453e6ae..5e80fcec 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -363,6 +363,20 @@ class DesktopTarget extends EventEmitter { } } +class MainLayout extends Clutter.BoxLayout { + static { + GObject.registerClass(this); + } + + vfunc_get_preferred_height(container, forWidth) { + const [mainChild] = container; + const [minHeight, natHeight] = + mainChild.get_preferred_height(forWidth); + + return [minHeight, natHeight + MENU_HEIGHT_OFFSET]; + } +} + class ApplicationsButton extends PanelMenu.Button { static { GObject.registerClass(this); @@ -530,7 +544,7 @@ class ApplicationsButton extends PanelMenu.Button { _createLayout() { let section = new PopupMenu.PopupMenuSection(); this.menu.addMenuItem(section); - this.mainBox = new St.BoxLayout({vertical: false}); + this.mainBox = new St.BoxLayout({layoutManager: new MainLayout()}); this.leftBox = new St.BoxLayout({vertical: true}); this.applicationsScrollBox = new St.ScrollView({ style_class: 'apps-menu vfade', @@ -594,12 +608,6 @@ class ApplicationsButton extends PanelMenu.Button { // Load applications this._displayButtons(this._listApplications(null)); - - let themeContext = St.ThemeContext.get_for_stage(global.stage); - let scaleFactor = themeContext.scale_factor; - let categoriesHeight = this.categoriesBox.height / scaleFactor; - let height = Math.round(categoriesHeight) + MENU_HEIGHT_OFFSET; - this.mainBox.style += `height: ${height}px`; } selectCategory(dir) { From d1ff0992007411616d4ee4a1649df61314b79d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 30 Nov 2023 20:31:54 +0100 Subject: [PATCH 05/11] window-list: Clean up stylesheet indent Replaces tabs with spaces. Part-of: --- extensions/window-list/stylesheet-dark.css | 86 +++++++++++----------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/extensions/window-list/stylesheet-dark.css b/extensions/window-list/stylesheet-dark.css index 5537e398..586cc147 100644 --- a/extensions/window-list/stylesheet-dark.css +++ b/extensions/window-list/stylesheet-dark.css @@ -6,115 +6,115 @@ */ .window-list { - spacing: 2px; - font-size: 10pt; + spacing: 2px; + font-size: 10pt; } .bottom-panel { - background-color: #000000; - border-top-width: 0px; - padding: 2px; + background-color: #000000; + border-top-width: 0px; + padding: 2px; } .window-button { - padding: 2px, 1px; + padding: 2px, 1px; } .window-button:first-child:ltr { - padding-left: 2px; + padding-left: 2px; } .window-button:last-child:rtl { - padding-right: 2px; + padding-right: 2px; } .window-button-box { - spacing: 4px; + spacing: 4px; } .window-button > StWidget, .window-picker-toggle > StWidget { - color: #bbb; - background-color: #1d1d1d; - border-radius: 4px; - padding: 3px 6px 1px; - transition: 100ms ease; + color: #bbb; + background-color: #1d1d1d; + border-radius: 4px; + padding: 3px 6px 1px; + transition: 100ms ease; } .window-button > StWidget { - -st-natural-width: 18.75em; - max-width: 18.75em; + -st-natural-width: 18.75em; + max-width: 18.75em; } .window-button:hover > StWidget, .window-picker-toggle:hover > StWidget { - color: #fff; - background-color: #303030; + color: #fff; + background-color: #303030; } .window-button:active > StWidget, .window-button:focus > StWidget { - color: #fff; - background-color: #3f3f3f; + color: #fff; + background-color: #3f3f3f; } .window-button.focused > StWidget, .window-picker-toggle:checked > StWidget { - color: #fff; - background-color: #3f3f3f; + color: #fff; + background-color: #3f3f3f; } .window-button.focused:active > StWidget, .window-picker-toggle:checked:active > StWidget { - color: #fff; - background-color: #3f3f3f; + color: #fff; + background-color: #3f3f3f; } .window-button.minimized > StWidget { - color: #666; - background-color: #161616; + color: #666; + background-color: #161616; } .window-button.minimized:active > StWidget { - color: #666; - background-color: #161616; + color: #666; + background-color: #161616; } .window-button-icon { - width: 24px; - height: 24px; + width: 24px; + height: 24px; } .window-list-workspace-indicator .status-label-bin { - background-color: rgba(200, 200, 200, 0.3); - padding: 0 3px; - margin: 3px; + background-color: rgba(200, 200, 200, 0.3); + padding: 0 3px; + margin: 3px; } .window-list-workspace-indicator .workspaces-box { - spacing: 3px; - padding: 3px; + spacing: 3px; + padding: 3px; } .window-list-workspace-indicator .workspace { - width: 52px; - border-radius: 4px; - background-color: #1e1e1e; + width: 52px; + border-radius: 4px; + background-color: #1e1e1e; } .window-list-workspace-indicator .workspace.active { - background-color: #3f3f3f; + background-color: #3f3f3f; } .window-list-window-preview { - background-color: #bebebe; - border-radius: 1px; + background-color: #bebebe; + border-radius: 1px; } .window-list-window-preview.active { - background-color: #d4d4d4; + background-color: #d4d4d4; } .notification { - font-weight: normal; + font-weight: normal; } From d5f617b3e235cacbccc5e5d4a0efbb36ca1d5a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 30 Nov 2023 20:43:50 +0100 Subject: [PATCH 06/11] window-list: Move additional padding into buttons Commit ca1c4b0f9e6 added additional padding, which means that the interactive area of buttons no longer extends to the bottom of the screen. Address this by moving the new padding into the buttons themselves. That restores the Fittsability of the bottom bar, without affecting the cleaner visual appearance. Close https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/453 Part-of: --- extensions/window-list/stylesheet-dark.css | 8 ++++---- extensions/window-list/stylesheet-light.css | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/extensions/window-list/stylesheet-dark.css b/extensions/window-list/stylesheet-dark.css index 586cc147..9ef5f25b 100644 --- a/extensions/window-list/stylesheet-dark.css +++ b/extensions/window-list/stylesheet-dark.css @@ -13,11 +13,11 @@ .bottom-panel { background-color: #000000; border-top-width: 0px; - padding: 2px; + height: 2.45em; } .window-button { - padding: 2px, 1px; + padding: 4px, 3px; } .window-button:first-child:ltr { @@ -87,13 +87,13 @@ .window-list-workspace-indicator .status-label-bin { background-color: rgba(200, 200, 200, 0.3); - padding: 0 3px; + padding: 5px; margin: 3px; } .window-list-workspace-indicator .workspaces-box { spacing: 3px; - padding: 3px; + padding: 5px; } .window-list-workspace-indicator .workspace { diff --git a/extensions/window-list/stylesheet-light.css b/extensions/window-list/stylesheet-light.css index 0bb2ab16..d52fd6b4 100644 --- a/extensions/window-list/stylesheet-light.css +++ b/extensions/window-list/stylesheet-light.css @@ -10,8 +10,7 @@ #panel.bottom-panel { border-top-width: 1px; border-bottom-width: 0px; - height: 2.25em ; - padding: 2px; + height: 2.5em; } .bottom-panel .window-button > StWidget, From 8efd73c50e8fbffa72e184115a38393b1a1411e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 1 Dec 2023 17:40:52 +0100 Subject: [PATCH 07/11] window-list: Don't hide previews on other monitors Workspace thumbnails are clipped, so there's no major benefit of hiding the actors explicitly. On the other hand, the check is useful on size/position changes to avoid unnecessary relayouts. Part-of: (cherry picked from commit 5c57f448381626529527145f471ec6b9cde461ae) --- extensions/window-list/workspaceIndicator.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js index 64e2071f..6d5657b2 100644 --- a/extensions/window-list/workspaceIndicator.js +++ b/extensions/window-list/workspaceIndicator.js @@ -36,11 +36,8 @@ class WindowPreview extends St.Button { this._window = window; this._window.connectObject( - 'size-changed', () => this.queue_relayout(), - 'position-changed', () => { - this._updateVisible(); - this.queue_relayout(); - }, + 'size-changed', () => this._checkRelayout(), + 'position-changed', () => this._checkRelayout(), 'notify::minimized', this._updateVisible.bind(this), this); this._updateVisible(); @@ -62,11 +59,15 @@ class WindowPreview extends St.Button { this.remove_style_class_name('active'); } - _updateVisible() { + _checkRelayout() { const monitor = Main.layoutManager.findIndexForActor(this); const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); - this.visible = this._window.get_frame_rect().overlap(workArea) && - this._window.window_type !== Meta.WindowType.DESKTOP && + if (this._window.get_frame_rect().overlap(workArea)) + this.queue_relayout(); + } + + _updateVisible() { + this.visible = this._window.window_type !== Meta.WindowType.DESKTOP && this._window.showing_on_its_workspace(); } } From a5343c33ecb11f3c2f2c81f1a25cbcd7f56bcb66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 1 Dec 2023 19:10:08 +0100 Subject: [PATCH 08/11] window-list: Update visibility on window-type changes The visibility depends on the type, so we should listen for changes (even if the property is unlikely to change). Part-of: (cherry picked from commit 071584621e92c594551179e2320bd75631f5a274) --- extensions/window-list/workspaceIndicator.js | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js index 6d5657b2..e576a9af 100644 --- a/extensions/window-list/workspaceIndicator.js +++ b/extensions/window-list/workspaceIndicator.js @@ -39,6 +39,7 @@ class WindowPreview extends St.Button { 'size-changed', () => this._checkRelayout(), 'position-changed', () => this._checkRelayout(), 'notify::minimized', this._updateVisible.bind(this), + 'notify::window-type', this._updateVisible.bind(this), this); this._updateVisible(); From a929cf9370b935084b5271a9937bd7b972b9e7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 1 Dec 2023 19:13:42 +0100 Subject: [PATCH 09/11] workspace-indicator: Don't hide previews on other monitors Workspace thumbnails are clipped, so there's no major benefit of hiding the actors explicitly. On the other hand, the check is useful on size/position changes to avoid unnecessary relayouts. Part-of: (cherry picked from commit b5b841dd38b9d7e62e9162eee56f7edebca32aa5) --- extensions/workspace-indicator/extension.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 0df9e038..28dca0ff 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -42,11 +42,8 @@ class WindowPreview extends St.Button { this._window = window; this._window.connectObject( - 'size-changed', () => this.queue_relayout(), - 'position-changed', () => { - this._updateVisible(); - this.queue_relayout(); - }, + 'size-changed', () => this._checkRelayout(), + 'position-changed', () => this._checkRelayout(), 'notify::minimized', this._updateVisible.bind(this), this); this._updateVisible(); @@ -68,11 +65,15 @@ class WindowPreview extends St.Button { this.remove_style_class_name('active'); } - _updateVisible() { + _checkRelayout() { const monitor = Main.layoutManager.findIndexForActor(this); const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); - this.visible = this._window.get_frame_rect().overlap(workArea) && - this._window.window_type !== Meta.WindowType.DESKTOP && + if (this._window.get_frame_rect().overlap(workArea)) + this.queue_relayout(); + } + + _updateVisible() { + this.visible = this._window.window_type !== Meta.WindowType.DESKTOP && this._window.showing_on_its_workspace(); } } From 8ed3b72a56cdb1ffdbde9b4a21beb430233d3a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 1 Dec 2023 19:14:26 +0100 Subject: [PATCH 10/11] workspace-indicator: Update visibility on window-type changes The visibility depends on the type, so we should listen for changes (even if the property is unlikely to change). Part-of: (cherry picked from commit 30a15387b5c6e8d47fb8d9f8043057e70a399925) --- extensions/workspace-indicator/extension.js | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 28dca0ff..58adf52f 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -45,6 +45,7 @@ class WindowPreview extends St.Button { 'size-changed', () => this._checkRelayout(), 'position-changed', () => this._checkRelayout(), 'notify::minimized', this._updateVisible.bind(this), + 'notify::window-type', this._updateVisible.bind(this), this); this._updateVisible(); From b02e43d84cf7a1956d2d8cc77079a64cddef4d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 1 Dec 2023 20:15:09 +0100 Subject: [PATCH 11/11] Bump version to 45.2 Update NEWS. --- NEWS | 11 +++++++++++ meson.build | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8c493511..54107e7d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,14 @@ +45.2 +==== +* window-list: Fix buttons not being clickable at the screen edge + [Florian; !291] +* window-list: Really fix initial preview visibility [Florian; !292] +* workspace-indicator: Really fix initial preview visibility [Florian; !292] +* Misc. bug fixes and cleanups [Florian; !290] + +Contributors: + Florian Müllner + 45.1 ==== * workspace-indicator: Fix initial preview visibility [Florian; !280] diff --git a/meson.build b/meson.build index f70c07d5..e70d6af5 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later project('gnome-shell-extensions', - version: '45.1', + version: '45.2', meson_version: '>= 0.58.0', license: 'GPL2+' )