From b978fd0cb8057ab4bc333bf8a278265d7bcd5597 Mon Sep 17 00:00:00 2001 From: Hanzen Shou Date: Wed, 27 Dec 2023 18:34:13 -0800 Subject: [PATCH 1/2] App is launching on mac --- frontend/src/main.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/main.js b/frontend/src/main.js index c25ecb4..1946add 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -22,7 +22,11 @@ process.on('uncaughtException', (error) => { // Keep a global reference of the window object to avoid it being garbage collected. let win; -const SHORTCUT = 'Ctrl+Shift+Alt+P'; +const SHORTCUT = () => { + if (process.platform == "win32") return 'Ctrl+Shift+Alt+P'; + if (process.platform == "darwin") return 'Option+Shift+P'; + return 'Unknown OS'; +}; let backendProcess = null; const appServe = app.isPackaged ? serve({ @@ -182,7 +186,7 @@ app.whenReady().then(() => { createWindow() // Register a global shortcut listener. - const ret = globalShortcut.register(SHORTCUT, () => { + const ret = globalShortcut.register(SHORTCUT(), () => { toggleWindow(); }); @@ -191,7 +195,7 @@ app.whenReady().then(() => { } // Check whether a shortcut is registered. - console.log(globalShortcut.isRegistered(SHORTCUT)); + console.log(globalShortcut.isRegistered(SHORTCUT())); }); // Quit when all windows are closed. From 07029961a2d651262e14b06db322a4ca43fbaee4 Mon Sep 17 00:00:00 2001 From: Hanzen Shou Date: Wed, 27 Dec 2023 19:04:05 -0800 Subject: [PATCH 2/2] Works on mac --- .DS_Store | Bin 0 -> 6148 bytes backend/Makefile | 1 + frontend/src/main.js | 7 ++++++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c88a062b05be4fd1d362b3e4c6a7481e718b69d0 GIT binary patch literal 6148 zcmeH~O$x$5422WzLU7Zi%h`AUZ!n0Spcima5J4*Vx1OW>k_m#k8KJGkN^pg011%5 z4-v3?8#bF)Wh4O-Ab}?V`#vPNX$~z_{nLTqBLK8P*$r!-C7{U)&>UK-q5{*H9yD6j z#}KP~J2b_)99pW@cF`C;crrWIXQgOGwy`I%~QMGk}L;X0y%TE9jyNVZZH|!@{KyzrRiVBQB0*--!1inh( E0rZ6u#{d8T literal 0 HcmV?d00001 diff --git a/backend/Makefile b/backend/Makefile index 6640927..54ecfca 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -32,6 +32,7 @@ venv: ## make virtual environment (activate with `source venv/Scripts/activate onefolder: onefolder: ## make pyinstaller exe within folder of dependencies + rm -rf dist/* $(PYINSTALLER) $(CLEAN) $(OUTPUT_NAME) $(ICON) $(EXTRA_HOOKS) $(MAIN_FILE) cp -r public ./dist/$(FILENAME)/public diff --git a/frontend/src/main.js b/frontend/src/main.js index 1946add..d8f585c 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -96,7 +96,12 @@ function tryStartBackend(win) { let backendPath = ""; let root = path.join(app.getAppPath(), "..", ".."); - backendPath = path.join(root, "backend", "backend_0p1.exe"); // Use double backslashes for Windows paths + let backend_executable = "backend_0p1.exe"; + + if (process.platform == "darwin") + backend_executable = "backend_0p1"; + + backendPath = path.join(root, "backend", backend_executable); // Use double backslashes for Windows paths // Use execFile // Define the backend executable and the arguments