Skip to content

Commit

Permalink
https://github.com/nbonamy/witsy/issues/23
Browse files Browse the repository at this point in the history
  • Loading branch information
nbonamy committed Dec 12, 2024
1 parent a951939 commit 3e5c800
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "witsy",
"productName": "Witsy",
"version": "1.27.1",
"version": "1.27.2",
"description": "Witsy: desktop AI assistant",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/automations/anywhere.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class PromptAnywhere {
}

// open prompt
await window.hideWindows();
await window.hideWindows([ window.promptAnywhereWindow ]);
await window.openPromptAnywhere({
foremostApp: foremostApp
});
Expand Down
4 changes: 1 addition & 3 deletions src/main/windows/anywhere.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ export const openPromptAnywhere = (params: strDict): BrowserWindow => {

// now send our signals
promptAnywhereWindow.webContents.send('show', params);
if (!promptAnywhereWindow.isVisible()) {
promptAnywhereWindow.show();
}
promptAnywhereWindow.show();

// done
return promptAnywhereWindow;
Expand Down
5 changes: 4 additions & 1 deletion src/main/windows/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,17 @@ export const releaseFocus = async () => {
};

let windowsToRestore: BrowserWindow[] = [];
export const hideWindows = async () => {
export const hideWindows = async (except: BrowserWindow[] = []) => {

// remember to restore all windows
windowsToRestore = [];
try {
// console.log('Hiding windows');
const windows = BrowserWindow.getAllWindows();
for (const window of windows) {
if (except.includes(window)) {
continue;
}
if (!window.isDestroyed() && window.isVisible() && !window.isMinimized()) {
windowsToRestore.push(window);
window.hide();
Expand Down
1 change: 1 addition & 0 deletions tests/unit/anywhere.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ vi.mock('../../src/main/config.ts', async () => {
// mock windows
vi.mock('../../src/main/window.ts', async () => {
return {
promptAnywhereWindow: null,
openPromptAnywhere: vi.fn(),
closePromptAnywhere: vi.fn(),
hideWindows: vi.fn(),
Expand Down

0 comments on commit 3e5c800

Please sign in to comment.