Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Mac Workspaces Switching #517

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ export class KandoApp {

// On all platforms except Windows, we show the window after we moved it.
if (process.platform !== 'win32') {
// Ensure the window is on the current worksspace before showing
this.window.setVisibleOnAllWorkspaces(true, { skipTransformProcessType: true });
setTimeout(() => {
this.window.setVisibleOnAllWorkspaces(false, { skipTransformProcessType: true });
}, 100);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this does not seem to be required on Linux, I would prefer if that was only done on macOS. So maybe move this before the if (process.platform !== 'win32') { into an if (process.platform === 'darwin' {?

Also, you could mention #461 in the comment so that we know in the future where this weirdo comes from 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Pushed a new commit with the change 👍️

// Now let's show the window
this.showWindow();
}

Expand Down Expand Up @@ -488,6 +494,12 @@ export class KandoApp {
// fullscreen applications.
this.window.setAlwaysOnTop(true, 'screen-saver');

// We set the Activation Policy to Accessory so that Kando doesn't show in dock
// or the CMD Tab App Switcher. This is only for MacOS.
if (process.platform === 'darwin') {
app.setActivationPolicy('accessory')
Copy link

@SeseMueller SeseMueller Jul 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is mac exclusive, a non-mac user needs to test it.
See this documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Added a commit with a condition which should make it mac-only.

}

// If the user clicks on a link, we close Kando's window and open the link in the
// default browser.
this.window.webContents.setWindowOpenHandler(({ url }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/main/backends/macos/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class MacosBackend implements Backend {
*/
public getBackendInfo() {
return {
windowType: 'panel',
windowType: 'normal',
supportsShortcuts: true,
};
}
Expand Down