]> code.delx.au - show-app-menu-on-key-press/commitdiff
gnome-shell 46 compatibility master
authorJames Bunton <jamesbunton@delx.au>
Fri, 29 Mar 2024 22:56:09 +0000 (09:56 +1100)
committerJames Bunton <jamesbunton@delx.au>
Fri, 29 Mar 2024 23:01:02 +0000 (10:01 +1100)
PKGBUILD
extension.js
metadata.json

index 14f676c8543162500c75ea0df2fd870cbc75daa2..f4a7900354f43ffb10f4555055da2e58ea489a67 100644 (file)
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,16 +1,15 @@
-# Maintainer: James Bunton <jamesbunton@delx.net.au>
+# Maintainer: James Bunton <jamesbunton@delx.au>
 
 pkgname=gnome-shell-extension-show-app-menu-on-key-press
 
 pkgname=gnome-shell-extension-show-app-menu-on-key-press
-pkgver=1
+pkgver=12
 pkgrel=1
 pkgdesc="Gnome shell extension to show app menu on key press"
 arch=('any')
 source=("extension.js" "metadata.json")
 pkgrel=1
 pkgdesc="Gnome shell extension to show app menu on key press"
 arch=('any')
 source=("extension.js" "metadata.json")
-sha512sums=('31a9f17536791c0cb3bd055ffa95bed555fdc6d78d5a895d2c0e41fea3d496fd9966ba202344c38ae508e28d4fb3433c759ddb04c2148dcb402d92763a879543'
-            'b356481db946a42f4ab92823ad29aa568696a52bb286f219605878535f2e353e0f3f118636c9a66046c4130f6e094205dea666833c6b63b0950a339e4b468a02')
+sha512sums=(SKIP SKIP)
 
 package() {
   for i in "${source[@]}"; do
 
 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
 }
   done
 }
index 58c40761d1d32b081962a9f9d86bba654e345547..34b7018b1d5f2b5267c0e745612cc21bd40078fa 100644 (file)
@@ -1,32 +1,37 @@
-const St = imports.gi.St;
-const Main = imports.ui.main;
-const Views = imports.ui.appDisplay.Views;
+import St from 'gi://St';
+import * as Main from 'resource:///org/gnome/shell/ui/main.js';
 
 
-let signalId = null;
+export default class ShowAppMenuOnKeyPressExtension {
 
 
-function init() {
-}
+    enable() {
+        // show apps on startup
+        Main.layoutManager.connect('startup-complete', () => {
+            Main.overview._overview._controls._toggleAppsPage();
+        });
 
 
-function enable() {
-    signalId = global.stage.connect('key-press-event', onStageKeyPress);
-}
+        // 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();
+            }
+        });
 
 
-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();
-        Main.overview.viewSelector.appDisplay._showView(Views.FREQUENT);
-        Main.overview.viewSelector._activePage.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
+    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());
+    }
 
 
+}
index 116122e1e5a5e25e37e0e6d4d79fcd9d045d1fe5..2b7a401fe60d4d29c73501ab116a77a2b57f454b 100644 (file)
@@ -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.au",
+    "shell-version": ["45.0", "46.0"]
+}