From 89cb58e52d33d9b0a4d3e90cc036cfa17f92d286 Mon Sep 17 00:00:00 2001 From: Kev Date: Sun, 26 Dec 2021 21:49:48 +0000 Subject: [PATCH] Rename quick actions to command palette --- myApp.js | 18 +++++++++--------- src/{quick-actions => command-palette}/bar.css | 0 .../bar.html | 2 +- src/{quick-actions => command-palette}/bar.js | 2 +- .../index.js | 8 ++++---- .../preload.js | 2 +- test/launch.spec.js | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) rename src/{quick-actions => command-palette}/bar.css (100%) rename src/{quick-actions => command-palette}/bar.html (95%) rename src/{quick-actions => command-palette}/bar.js (99%) rename src/{quick-actions => command-palette}/index.js (95%) rename src/{quick-actions => command-palette}/preload.js (86%) diff --git a/myApp.js b/myApp.js index a471c74..f1769e9 100644 --- a/myApp.js +++ b/myApp.js @@ -52,8 +52,8 @@ const { JSDOM } = jsdom; const nodeCrypto = require('crypto'); const processInfo = require('./lib/process-info'); const version = require('./package.json').version; -const QuickActions = require('./src/quick-actions'); -let quickActions; +const CommandPalette = require('./src/command-palette'); +let commandPalette; global.DOMParser = new JSDOM().window.DOMParser; process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'; @@ -1109,7 +1109,7 @@ ipcMain.on('delete-project', (event, arg) => { ipcMain.on('delete-shortcut', (event, arg) => { store.shortcuts = store.shortcuts.filter((keys) => keys !== arg); - setupQuickActions(); + setupCommandPalette(); repaintShortcuts(); }); @@ -1151,7 +1151,7 @@ ipcMain.on('logout', (event, arg) => { mb.on('ready', () => { setupContextMenu(); - setupQuickActions(); + setupCommandPalette(); }); if (store.access_token && store.user_id && store.username) { @@ -1255,12 +1255,12 @@ function setupGenericContextMenu(baseMenuItems) { }); } -function setupQuickActions() { - if (!quickActions) { - quickActions = new QuickActions(); +function setupCommandPalette() { + if (!commandPalette) { + commandPalette = new CommandPalette(); } - quickActions.register({ + commandPalette.register({ shortcut: store.shortcuts, }); } @@ -2951,7 +2951,7 @@ function addShortcut(link) { escapeQuotes(spinner) + ' Add"', ); - setupQuickActions(); + setupCommandPalette(); repaintShortcuts(); } diff --git a/src/quick-actions/bar.css b/src/command-palette/bar.css similarity index 100% rename from src/quick-actions/bar.css rename to src/command-palette/bar.css diff --git a/src/quick-actions/bar.html b/src/command-palette/bar.html similarity index 95% rename from src/quick-actions/bar.html rename to src/command-palette/bar.html index 72f2c8e..c1cbdd6 100644 --- a/src/quick-actions/bar.html +++ b/src/command-palette/bar.html @@ -4,7 +4,7 @@ - GitDock Quick Actions + GitDock Command Palette { }); const hide = () => { - gitdock.hideQuickActions(); + gitdock.hideCommandPalette(); $search.value = ''; search(); }; diff --git a/src/quick-actions/index.js b/src/command-palette/index.js similarity index 95% rename from src/quick-actions/index.js rename to src/command-palette/index.js index cdfec84..6c5ff31 100644 --- a/src/quick-actions/index.js +++ b/src/command-palette/index.js @@ -89,7 +89,7 @@ setInterval(() => { }, 15000); getRecentlyVisited(); -module.exports = class QuickActions { +module.exports = class CommandPalette { constructor() { cpWindow = this.newWindow(); cpWindow.on('blur', () => { @@ -109,7 +109,7 @@ module.exports = class QuickActions { shell.openExternal(`${store.host}${arg}`); } }); - ipcMain.on('hide-quick-actions', () => { + ipcMain.on('hide-command-palette', () => { cpWindow.hide(); }); } @@ -118,7 +118,7 @@ module.exports = class QuickActions { globalShortcut.unregisterAll(); ipcMain.removeAllListeners('open-gitlab'); - ipcMain.removeAllListeners('hide-quick-actions'); + ipcMain.removeAllListeners('hide-command-palette'); } async open() { @@ -145,7 +145,7 @@ module.exports = class QuickActions { webPreferences: { preload: PRELOAD_PATH, }, - title: 'GitDock Quick Actions', + title: 'GitDock Command Palette', }); if (show) { window.once('ready-to-show', () => { diff --git a/src/quick-actions/preload.js b/src/command-palette/preload.js similarity index 86% rename from src/quick-actions/preload.js rename to src/command-palette/preload.js index 5baa9a6..2729b68 100644 --- a/src/quick-actions/preload.js +++ b/src/command-palette/preload.js @@ -3,7 +3,7 @@ const { store } = require('../../lib/store'); const api = { openGitLab: (url) => ipcRenderer.send('open-gitlab', url), - hideQuickActions: () => ipcRenderer.send('hide-quick-actions'), + hideCommandPalette: () => ipcRenderer.send('hide-command-palette'), getUsername: () => store.username, getFavorites: () => store['favorite-projects'], getBookmarks: () => store['bookmarks'], diff --git a/test/launch.spec.js b/test/launch.spec.js index 344c05f..32c593b 100644 --- a/test/launch.spec.js +++ b/test/launch.spec.js @@ -10,7 +10,7 @@ describe('Application launch', function () { stopAppAfterEach(); - it('starts the menubar and quick actions windows', async function () { + it('starts the menubar window', async function () { const windows = await this.app.windows(); assert.equal(windows.length, 1); });