From fc351cc60b707853513217f510b7a0afed86e13c Mon Sep 17 00:00:00 2001 From: James Bunton Date: Wed, 6 May 2020 23:19:07 +1000 Subject: [PATCH 1/9] Hacks to work around gnome-shell popup-menu bug Steps to reproduce bug: - Open application overview - Right-click on an icon to open the popup menu - Now navigate to that icon with the keyboard - Press right Expected: Focus moves to the next icon Actual: Popup menu appears --- PKGBUILD | 4 ++-- extension.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 14f676c..0bd8b9f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,12 +1,12 @@ # Maintainer: James Bunton pkgname=gnome-shell-extension-show-app-menu-on-key-press -pkgver=1 +pkgver=3 pkgrel=1 pkgdesc="Gnome shell extension to show app menu on key press" arch=('any') source=("extension.js" "metadata.json") -sha512sums=('31a9f17536791c0cb3bd055ffa95bed555fdc6d78d5a895d2c0e41fea3d496fd9966ba202344c38ae508e28d4fb3433c759ddb04c2148dcb402d92763a879543' +sha512sums=('bffe74753a8567e2c6500b6a1c21130f99b1e3dfe23613e10597abb80f3549ea1d6327db0e75961ab1ccdf013733fdc283dde94cee34c1f666de86f745339e91' 'b356481db946a42f4ab92823ad29aa568696a52bb286f219605878535f2e353e0f3f118636c9a66046c4130f6e094205dea666833c6b63b0950a339e4b468a02') package() { diff --git a/extension.js b/extension.js index 58c4076..6bad7ea 100644 --- a/extension.js +++ b/extension.js @@ -21,7 +21,13 @@ function disable() { function onStageKeyPress() { if (!hasVisibleWindows() && !Main.overview.visible) { Main.overview.viewSelector.showApps(); - Main.overview.viewSelector.appDisplay._showView(Views.FREQUENT); + const appDisplay = Main.overview.viewSelector.appDisplay; + const view = appDisplay._views[Views.FREQUENT].view; + view._grid.destroyAll() + view._items = new Map(); + view._orderedItems = []; + view._redisplay(); + appDisplay._showView(Views.FREQUENT); Main.overview.viewSelector._activePage.navigate_focus(null, St.DirectionType.TAB_FORWARD, false); } } -- 2.39.2 From c0c7c3e4f2aa36848b9fbb1c29db6f68a79a9f35 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Fri, 9 Oct 2020 23:34:05 +1100 Subject: [PATCH 2/9] Compatibility with Gnome 3.38 --- PKGBUILD | 4 ++-- extension.js | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 0bd8b9f..fe2e134 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,12 +1,12 @@ # Maintainer: James Bunton pkgname=gnome-shell-extension-show-app-menu-on-key-press -pkgver=3 +pkgver=4 pkgrel=1 pkgdesc="Gnome shell extension to show app menu on key press" arch=('any') source=("extension.js" "metadata.json") -sha512sums=('bffe74753a8567e2c6500b6a1c21130f99b1e3dfe23613e10597abb80f3549ea1d6327db0e75961ab1ccdf013733fdc283dde94cee34c1f666de86f745339e91' +sha512sums=('d37606c62e27de94e6da2deebc4c632a77243c4bb820e4582a01b1f0305cb0e0e99f699e4b468d9bca86133bd0dfbd280c2cf9f08f29f313fe80647965f28d29' 'b356481db946a42f4ab92823ad29aa568696a52bb286f219605878535f2e353e0f3f118636c9a66046c4130f6e094205dea666833c6b63b0950a339e4b468a02') package() { diff --git a/extension.js b/extension.js index 6bad7ea..96fcac8 100644 --- a/extension.js +++ b/extension.js @@ -22,12 +22,18 @@ function onStageKeyPress() { if (!hasVisibleWindows() && !Main.overview.visible) { Main.overview.viewSelector.showApps(); const appDisplay = Main.overview.viewSelector.appDisplay; - const view = appDisplay._views[Views.FREQUENT].view; - view._grid.destroyAll() + let view = appDisplay; + if (appDisplay._views) { // Gnome 3.36 or older + + view = appDisplay._views[Views.FREQUENT].view; + } + view._grid.remove_all_children() view._items = new Map(); view._orderedItems = []; view._redisplay(); - appDisplay._showView(Views.FREQUENT); + if (appDisplay._showView) { // Gnome 3.36 or older + appDisplay._showView(Views.FREQUENT); + } Main.overview.viewSelector._activePage.navigate_focus(null, St.DirectionType.TAB_FORWARD, false); } } -- 2.39.2 From 361cce786d16a45c64b57d3c17763566ef6bd3b9 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Sat, 10 Apr 2021 16:04:00 +1000 Subject: [PATCH 3/9] gnome-shell 40 compatibility --- PKGBUILD | 6 +++--- extension.js | 49 +++++++++++++++++++++---------------------------- metadata.json | 7 ++++++- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index fe2e134..adeae55 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,13 +1,13 @@ # Maintainer: James Bunton pkgname=gnome-shell-extension-show-app-menu-on-key-press -pkgver=4 +pkgver=5 pkgrel=1 pkgdesc="Gnome shell extension to show app menu on key press" arch=('any') source=("extension.js" "metadata.json") -sha512sums=('d37606c62e27de94e6da2deebc4c632a77243c4bb820e4582a01b1f0305cb0e0e99f699e4b468d9bca86133bd0dfbd280c2cf9f08f29f313fe80647965f28d29' - 'b356481db946a42f4ab92823ad29aa568696a52bb286f219605878535f2e353e0f3f118636c9a66046c4130f6e094205dea666833c6b63b0950a339e4b468a02') +sha512sums=('9a2c5a611a4e7053aee91ab3969367b2098a512eae6b2f8651e08cb17d8b023afeaf04371ed082808863928d123bbfbe25728bba72b73410deff00888869e880' + 'be121818c871436d8218f27b73976f550e42f1e442df38c6b6f17fc722271774ea6bb3ee1972b2089ad4c06968e2bf68f495520bfafd9e62fb0553d5fda9ef11') package() { for i in "${source[@]}"; do diff --git a/extension.js b/extension.js index 96fcac8..9fcc55d 100644 --- a/extension.js +++ b/extension.js @@ -1,41 +1,34 @@ const St = imports.gi.St; const Main = imports.ui.main; -const Views = imports.ui.appDisplay.Views; - -let signalId = null; function init() { } function enable() { - signalId = global.stage.connect('key-press-event', onStageKeyPress); -} + // show apps on startup + Main.layoutManager.connect('startup-complete', () => { + Main.overview._overview._controls._toggleAppsPage(); + }); + + // show apps on key press when there are no windows + global.stage.connect('key-press-event', () => { + if (!hasVisibleWindows() && !Main.overview.visible) { + Main.overview.showApps(); + } + }); -function disable() { - if (signalId) { - global.stage.disconnect('key-press-event'); - signalId = null; - } + // keyboard focus for apps view + Main.overview.connect('shown', () => { + if (Main.overview._overview.dash.showAppsButton.checked) { + Main.overview._overview._controls.appDisplay.navigate_focus(null, St.DirectionType.TAB_FORWARD, false) + } + }); + Main.overview._overview.controls.appDisplay.connect('view-loaded', () => { + Main.overview._overview._controls.appDisplay.navigate_focus(null, St.DirectionType.TAB_FORWARD, false) + }); } -function onStageKeyPress() { - if (!hasVisibleWindows() && !Main.overview.visible) { - Main.overview.viewSelector.showApps(); - const appDisplay = Main.overview.viewSelector.appDisplay; - let view = appDisplay; - if (appDisplay._views) { // Gnome 3.36 or older - - view = appDisplay._views[Views.FREQUENT].view; - } - view._grid.remove_all_children() - view._items = new Map(); - view._orderedItems = []; - view._redisplay(); - if (appDisplay._showView) { // Gnome 3.36 or older - appDisplay._showView(Views.FREQUENT); - } - Main.overview.viewSelector._activePage.navigate_focus(null, St.DirectionType.TAB_FORWARD, false); - } +function disable() { } function hasVisibleWindows() { diff --git a/metadata.json b/metadata.json index 116122e..cf180ca 100644 --- a/metadata.json +++ b/metadata.json @@ -1 +1,6 @@ -{"name": "Show App Menu on Key Press", "description": "Show the app menu when any key is pressed and all windows are closed or hidden", "uuid": "show-app-menu-on-key-press@delx.net.au", "shell-version": ["3.34.1"]} +{ + "name": "Show App Menu on Key Press", + "description": "Show the app menu when any key is pressed and all windows are closed or hidden", + "uuid": "show-app-menu-on-key-press@delx.net.au", + "shell-version": ["40.0"] +} -- 2.39.2 From 4964e7263ead044bbdcde9b01700dfa8d227eb64 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Sat, 20 Nov 2021 23:35:17 +1100 Subject: [PATCH 4/9] gnome-shell 41 compatibility --- PKGBUILD | 4 ++-- metadata.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index adeae55..07f9b31 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,13 +1,13 @@ # Maintainer: James Bunton pkgname=gnome-shell-extension-show-app-menu-on-key-press -pkgver=5 +pkgver=6 pkgrel=1 pkgdesc="Gnome shell extension to show app menu on key press" arch=('any') source=("extension.js" "metadata.json") sha512sums=('9a2c5a611a4e7053aee91ab3969367b2098a512eae6b2f8651e08cb17d8b023afeaf04371ed082808863928d123bbfbe25728bba72b73410deff00888869e880' - 'be121818c871436d8218f27b73976f550e42f1e442df38c6b6f17fc722271774ea6bb3ee1972b2089ad4c06968e2bf68f495520bfafd9e62fb0553d5fda9ef11') + '79acd444309840b8734a216668288bdc04f324da4278ad8397bbe106d8747422ce940ed1e4a457eb196bff66f40ee515420bea02535ab26e081da307fd358ab0') package() { for i in "${source[@]}"; do diff --git a/metadata.json b/metadata.json index cf180ca..4e18300 100644 --- a/metadata.json +++ b/metadata.json @@ -2,5 +2,5 @@ "name": "Show App Menu on Key Press", "description": "Show the app menu when any key is pressed and all windows are closed or hidden", "uuid": "show-app-menu-on-key-press@delx.net.au", - "shell-version": ["40.0"] + "shell-version": ["40.0", "41.0"] } -- 2.39.2 From c57e0f16a31e627199673614abf414879dd863c4 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Fri, 22 Apr 2022 20:31:46 +1000 Subject: [PATCH 5/9] gnome-shell 42 compatibility --- PKGBUILD | 4 ++-- metadata.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 07f9b31..d93b2e6 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,13 +1,13 @@ # Maintainer: James Bunton pkgname=gnome-shell-extension-show-app-menu-on-key-press -pkgver=6 +pkgver=7 pkgrel=1 pkgdesc="Gnome shell extension to show app menu on key press" arch=('any') source=("extension.js" "metadata.json") sha512sums=('9a2c5a611a4e7053aee91ab3969367b2098a512eae6b2f8651e08cb17d8b023afeaf04371ed082808863928d123bbfbe25728bba72b73410deff00888869e880' - '79acd444309840b8734a216668288bdc04f324da4278ad8397bbe106d8747422ce940ed1e4a457eb196bff66f40ee515420bea02535ab26e081da307fd358ab0') + '47d5dcef46fdab89c5624e0ad3d6bb0c8075caec46e3620a8cedc10d086e4edb7dfd9dbd8962fcfa5d1c8e6c668678131d49840ad16b00c90efcb4ab9c4654df') package() { for i in "${source[@]}"; do diff --git a/metadata.json b/metadata.json index 4e18300..f7b89b9 100644 --- a/metadata.json +++ b/metadata.json @@ -2,5 +2,5 @@ "name": "Show App Menu on Key Press", "description": "Show the app menu when any key is pressed and all windows are closed or hidden", "uuid": "show-app-menu-on-key-press@delx.net.au", - "shell-version": ["40.0", "41.0"] + "shell-version": ["40.0", "41.0", "42.0"] } -- 2.39.2 From 26f209ee0f382a38a996049308bbb4cad4546d7e Mon Sep 17 00:00:00 2001 From: James Bunton Date: Sat, 19 Nov 2022 14:44:22 +1100 Subject: [PATCH 6/9] gnome-shell 43 compatibility --- PKGBUILD | 4 ++-- metadata.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index d93b2e6..0fd6b20 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,13 +1,13 @@ # Maintainer: James Bunton pkgname=gnome-shell-extension-show-app-menu-on-key-press -pkgver=7 +pkgver=8 pkgrel=1 pkgdesc="Gnome shell extension to show app menu on key press" arch=('any') source=("extension.js" "metadata.json") sha512sums=('9a2c5a611a4e7053aee91ab3969367b2098a512eae6b2f8651e08cb17d8b023afeaf04371ed082808863928d123bbfbe25728bba72b73410deff00888869e880' - '47d5dcef46fdab89c5624e0ad3d6bb0c8075caec46e3620a8cedc10d086e4edb7dfd9dbd8962fcfa5d1c8e6c668678131d49840ad16b00c90efcb4ab9c4654df') + '09dfbcaa3b35f3d9efa455b31726df51d693da7d726d59f08322b591249967b1202ee8695ba0bcfaeb967aac9476503c1fb249c16b86085cf2019a608954a782') package() { for i in "${source[@]}"; do diff --git a/metadata.json b/metadata.json index f7b89b9..625805b 100644 --- a/metadata.json +++ b/metadata.json @@ -2,5 +2,5 @@ "name": "Show App Menu on Key Press", "description": "Show the app menu when any key is pressed and all windows are closed or hidden", "uuid": "show-app-menu-on-key-press@delx.net.au", - "shell-version": ["40.0", "41.0", "42.0"] + "shell-version": ["40.0", "41.0", "42.0", "43.0"] } -- 2.39.2 From 48b9a3903fdffd6aac2e99891ed7b6703512c989 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Thu, 8 Jun 2023 21:59:46 +1000 Subject: [PATCH 7/9] gnome-shell 44 compatibility --- PKGBUILD | 5 ++--- metadata.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 0fd6b20..cc37d6c 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,13 +1,12 @@ # Maintainer: James Bunton pkgname=gnome-shell-extension-show-app-menu-on-key-press -pkgver=8 +pkgver=9 pkgrel=1 pkgdesc="Gnome shell extension to show app menu on key press" arch=('any') source=("extension.js" "metadata.json") -sha512sums=('9a2c5a611a4e7053aee91ab3969367b2098a512eae6b2f8651e08cb17d8b023afeaf04371ed082808863928d123bbfbe25728bba72b73410deff00888869e880' - '09dfbcaa3b35f3d9efa455b31726df51d693da7d726d59f08322b591249967b1202ee8695ba0bcfaeb967aac9476503c1fb249c16b86085cf2019a608954a782') +sha512sums=(SKIP SKIP) package() { for i in "${source[@]}"; do diff --git a/metadata.json b/metadata.json index 625805b..7826d6b 100644 --- a/metadata.json +++ b/metadata.json @@ -2,5 +2,5 @@ "name": "Show App Menu on Key Press", "description": "Show the app menu when any key is pressed and all windows are closed or hidden", "uuid": "show-app-menu-on-key-press@delx.net.au", - "shell-version": ["40.0", "41.0", "42.0", "43.0"] + "shell-version": ["40.0", "41.0", "42.0", "43.0", "44.0"] } -- 2.39.2 From 5cd96eb89ca8fb22630843be524454881e4ca424 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Thu, 30 Nov 2023 08:01:38 +1100 Subject: [PATCH 8/9] gnome-shell 45 compatibility --- PKGBUILD | 5 +++-- extension.js | 58 +++++++++++++++++++++++++-------------------------- metadata.json | 2 +- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index cc37d6c..eb7d16b 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,12 +1,13 @@ # Maintainer: James Bunton pkgname=gnome-shell-extension-show-app-menu-on-key-press -pkgver=9 +pkgver=11 pkgrel=1 pkgdesc="Gnome shell extension to show app menu on key press" arch=('any') source=("extension.js" "metadata.json") -sha512sums=(SKIP SKIP) + + package() { for i in "${source[@]}"; do diff --git a/extension.js b/extension.js index 9fcc55d..34b7018 100644 --- a/extension.js +++ b/extension.js @@ -1,37 +1,37 @@ -const St = imports.gi.St; -const Main = imports.ui.main; +import St from 'gi://St'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; -function init() { -} +export default class ShowAppMenuOnKeyPressExtension { -function enable() { - // show apps on startup - Main.layoutManager.connect('startup-complete', () => { - Main.overview._overview._controls._toggleAppsPage(); - }); + enable() { + // show apps on startup + Main.layoutManager.connect('startup-complete', () => { + Main.overview._overview._controls._toggleAppsPage(); + }); - // show apps on key press when there are no windows - global.stage.connect('key-press-event', () => { - if (!hasVisibleWindows() && !Main.overview.visible) { - Main.overview.showApps(); - } - }); + // show apps on key press when there are no windows + global.stage.connect('key-press-event', () => { + if (!this.hasVisibleWindows() && !Main.overview.visible) { + Main.overview.showApps(); + } + }); - // keyboard focus for apps view - Main.overview.connect('shown', () => { - if (Main.overview._overview.dash.showAppsButton.checked) { + // keyboard focus for apps view + Main.overview.connect('shown', () => { + if (Main.overview._overview.dash.showAppsButton.checked) { + Main.overview._overview._controls.appDisplay.navigate_focus(null, St.DirectionType.TAB_FORWARD, false) + } + }); + Main.overview._overview.controls.appDisplay.connect('view-loaded', () => { Main.overview._overview._controls.appDisplay.navigate_focus(null, St.DirectionType.TAB_FORWARD, false) - } - }); - Main.overview._overview.controls.appDisplay.connect('view-loaded', () => { - Main.overview._overview._controls.appDisplay.navigate_focus(null, St.DirectionType.TAB_FORWARD, false) - }); -} + }); + } -function disable() { -} + disable() { + } -function hasVisibleWindows() { - return global.display.get_tab_list(0, null).find((w) => !w.is_hidden()); -} + hasVisibleWindows() { + return global.display.get_tab_list(0, null).find((w) => !w.is_hidden()); + } +} diff --git a/metadata.json b/metadata.json index 7826d6b..b38fbcd 100644 --- a/metadata.json +++ b/metadata.json @@ -2,5 +2,5 @@ "name": "Show App Menu on Key Press", "description": "Show the app menu when any key is pressed and all windows are closed or hidden", "uuid": "show-app-menu-on-key-press@delx.net.au", - "shell-version": ["40.0", "41.0", "42.0", "43.0", "44.0"] + "shell-version": ["45.0"] } -- 2.39.2 From 8bb219cad5fc413f70696cc45c323537ecefff5b Mon Sep 17 00:00:00 2001 From: James Bunton Date: Sat, 30 Mar 2024 09:56:09 +1100 Subject: [PATCH 9/9] gnome-shell 46 compatibility --- PKGBUILD | 9 ++++----- metadata.json | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index eb7d16b..f4a7900 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,16 +1,15 @@ -# Maintainer: James Bunton +# Maintainer: James Bunton pkgname=gnome-shell-extension-show-app-menu-on-key-press -pkgver=11 +pkgver=12 pkgrel=1 pkgdesc="Gnome shell extension to show app menu on key press" arch=('any') source=("extension.js" "metadata.json") - - +sha512sums=(SKIP SKIP) package() { for i in "${source[@]}"; do - install -Dm 644 "$i" "${pkgdir}/usr/share/gnome-shell/extensions/show-app-menu-on-key-press@delx.net.au/${i}" + install -Dm 644 "$i" "${pkgdir}/usr/share/gnome-shell/extensions/show-app-menu-on-key-press@delx.au/${i}" done } diff --git a/metadata.json b/metadata.json index b38fbcd..2b7a401 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "Show App Menu on Key Press", "description": "Show the app menu when any key is pressed and all windows are closed or hidden", - "uuid": "show-app-menu-on-key-press@delx.net.au", - "shell-version": ["45.0"] + "uuid": "show-app-menu-on-key-press@delx.au", + "shell-version": ["45.0", "46.0"] } -- 2.39.2