Initial commit
authorJames Bunton <jamesbunton@delx.net.au>
Thu, 30 Jan 2020 11:58:17 +0000 (22:58 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Fri, 31 Jan 2020 11:20:26 +0000 (22:20 +1100)
PKGBUILD [new file with mode: 0644]
extension.js [new file with mode: 0644]
metadata.json [new file with mode: 0644]

diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644 (file)
index 0000000..14f676c
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,16 @@
+# Maintainer: James Bunton <jamesbunton@delx.net.au>
+
+pkgname=gnome-shell-extension-show-app-menu-on-key-press
+pkgver=1
+pkgrel=1
+pkgdesc="Gnome shell extension to show app menu on key press"
+arch=('any')
+source=("extension.js" "metadata.json")
+sha512sums=('31a9f17536791c0cb3bd055ffa95bed555fdc6d78d5a895d2c0e41fea3d496fd9966ba202344c38ae508e28d4fb3433c759ddb04c2148dcb402d92763a879543'
+            'b356481db946a42f4ab92823ad29aa568696a52bb286f219605878535f2e353e0f3f118636c9a66046c4130f6e094205dea666833c6b63b0950a339e4b468a02')
+
+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}"
+  done
+}
diff --git a/extension.js b/extension.js
new file mode 100644 (file)
index 0000000..58c4076
--- /dev/null
@@ -0,0 +1,32 @@
+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);
+}
+
+function disable() {
+    if (signalId) {
+        global.stage.disconnect('key-press-event');
+        signalId = null;
+    }
+}
+
+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);
+    }
+}
+
+function hasVisibleWindows() {
+    return global.display.get_tab_list(0, null).find((w) => !w.is_hidden());
+}
+
diff --git a/metadata.json b/metadata.json
new file mode 100644 (file)
index 0000000..116122e
--- /dev/null
@@ -0,0 +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": ["3.34.1"]}