From 187beafbe180deb19b267a4e8b74c4f6ea57c284 Mon Sep 17 00:00:00 2001 From: roylee0912 Date: Sun, 2 Feb 2025 17:22:02 -0500 Subject: [PATCH] fixed weird bug for undetectability from nuke guy --- README.md | 2 -- electron/main.ts | 19 ++++++++++--------- electron/shortcuts.ts | 14 -------------- package.json | 2 +- 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 759f4bb..d1bb608 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,8 @@ An invisible desktop application that will help you pass your technical interviews. - https://github.com/user-attachments/assets/0615b110-2670-4b0e-bc69-3c32a2d8a996 - ## Invisibility Compatibility The application is invisible to: diff --git a/electron/main.ts b/electron/main.ts index 3a76f91..6ca73c4 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -375,12 +375,13 @@ function hideMainWindow(): void { state.windowPosition = { x: bounds.x, y: bounds.y } state.windowSize = { width: bounds.width, height: bounds.height } state.mainWindow.setIgnoreMouseEvents(true, { forward: true }) - state.mainWindow.setFocusable(false) + state.mainWindow.setAlwaysOnTop(true, "floating", 1) + state.mainWindow.setVisibleOnAllWorkspaces(true, { + visibleOnFullScreen: true + }) state.mainWindow.setOpacity(0) state.mainWindow.hide() state.isWindowVisible = false - // Ensure we don't steal focus when hiding - app.hide() } } @@ -393,15 +394,15 @@ function showMainWindow(): void { }) } state.mainWindow.setIgnoreMouseEvents(false) - state.mainWindow.setFocusable(true) + state.mainWindow.setAlwaysOnTop(true, "floating", 1) + state.mainWindow.setVisibleOnAllWorkspaces(true, { + visibleOnFullScreen: true + }) + state.mainWindow.setContentProtection(true) state.mainWindow.setOpacity(0) - state.mainWindow.show() - state.mainWindow.setOpacity(1) - // Use showInactive to prevent stealing focus state.mainWindow.showInactive() + state.mainWindow.setOpacity(1) state.isWindowVisible = true - // Ensure we don't activate the app - app.hide() } } diff --git a/electron/shortcuts.ts b/electron/shortcuts.ts index 348b609..4113828 100644 --- a/electron/shortcuts.ts +++ b/electron/shortcuts.ts @@ -77,20 +77,6 @@ export class ShortcutsHelper { globalShortcut.register("CommandOrControl+B", () => { this.deps.toggleMainWindow() - // If window exists and we're showing it, bring it to front - const mainWindow = this.deps.getMainWindow() - if (mainWindow && !this.deps.isVisible()) { - // Force the window to the front on macOS - if (process.platform === "darwin") { - mainWindow.setAlwaysOnTop(true, "normal") - // Reset alwaysOnTop after a brief delay - setTimeout(() => { - if (mainWindow && !mainWindow.isDestroyed()) { - mainWindow.setAlwaysOnTop(true, "floating") - } - }, 100) - } - } }) // Unregister shortcuts when quitting diff --git a/package.json b/package.json index 3ed3e88..bb455da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interview-coder-v1", - "version": "1.0.9", + "version": "1.0.10", "main": "dist-electron/main.js", "scripts": { "clean": "rimraf dist dist-electron",