Skip to content

Commit

Permalink
fix(windows): hide runs actualHide
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed May 20, 2024
1 parent eeb82a1 commit 0442adb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"super-silly": "cross-env ELECTRON_ENABLE_STACK_DUMPING=true ELECTRON_ENABLE_LOGGING=true LOG_LEVEL=silly yarn start",
"start": "cross-env NODE_ENV=development yarn start-$(node -e \"console.log(process.platform === 'darwin' ? 'mac' : process.platform === 'win32' ? 'windows' : 'linux')\")",
"start-mac": "./vite-dev.sh",
"start-windows": "eletron-vite preview",
"start-windows": "electron-vite preview",
"start-linux": "electron-vite preview",
"sponsor": "KIT_SPONSOR=development yarn start",
"tiktok": "KIT_SPONSOR=development KIT_TIKTOK=development yarn start",
Expand All @@ -38,7 +38,6 @@
"cp-vs-assets": "cp -R ./node_modules/monaco-editor/min/vs ./assets",
"v": "PATH=~/.knode/bin:$PATH node --version",
"write-node-version": "node ./scripts/write-node-version.js",
"vite-start": "electron-vite preview",
"vite-dev": "./vite-dev.sh",
"vite-prebuild": "electron-vite build",
"vite-package": "electron-vite build && DEBUG_PROD=true electron-builder --mac --arm64 -c.mac.identity=null --publish never",
Expand Down
10 changes: 10 additions & 0 deletions scripts/remove-mac.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import '@johnlindquist/kit';

console.log(`Removing REMOVE-MAC ⛳️`);

try {
await exec(
'npm un --force node-mac-permissions @johnlindquist/mac-clipboard-listener @johnlindquist/mac-frontmost @johnlindquist/mac-panel-window',
{ stdio: 'inherit' },
);
console.log('Successfully removed mac-specific packages.');
} catch (error) {
console.error('Error removing mac-specific packages:', error);
}

let srcFilePath = path
.resolve(process.env?.PWD || '', 'src', '**', '*')
.replace(/\\/g, '/');
Expand Down
25 changes: 14 additions & 11 deletions src/main/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,10 @@ export class KitPrompt {
if (kitState?.kenvEnv?.KIT_DISABLE_PREVIOUS_ACTIVE_WINDOW !== 'true') {
const currentWindow = windowManager.getActiveWindow();
if (currentWindow.processId !== process.pid) {
log.info(`Storing previous window: ${currentWindow.processId}`);
log.info(
`Storing previous window: ${currentWindow.processId}`,
currentWindow,
);
prevWindow = currentWindow;
}
}
Expand All @@ -1227,7 +1230,7 @@ export class KitPrompt {
log.warn(`Prompt window is destroyed. Not hiding.`);
return;
}
this.window.hide();
this.actualHide();
};

onHideOnce = (fn: () => void) => {
Expand Down Expand Up @@ -2022,19 +2025,19 @@ export class KitPrompt {
// REMOVE-NODE-WINDOW-MANAGER
windowManager.hideInstantly(this.window?.getNativeWindowHandle());
this.window?.emit('hide');
if (prevWindow) {
try {
prevWindow?.bringToTop();
} catch (error) {
log.error(error);
}
} else {
log.info(`No previous window to bring to top...`);
}
// END-REMOVE-NODE-WINDOW-MANAGER
} else {
this.window?.hide();
}
// REMOVE-NODE-WINDOW-MANAGER
if (kitState.isWindows && prevWindow) {
try {
prevWindow?.bringToTop();
} catch (error) {
log.error(error);
}
}
// END-REMOVE-NODE-WINDOW-MANAGER
};

isVisible = () => {
Expand Down

0 comments on commit 0442adb

Please sign in to comment.