Skip to content

Commit

Permalink
fix: secondary window not loading if not active
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Dec 30, 2023
1 parent 32485a1 commit 0258c8a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/services/view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export class View implements IViewService {
if (this.shouldMuteAudio !== undefined) {
view.webContents.audioMuted = this.shouldMuteAudio;
}
if (workspace.active) {
if (workspace.active || windowName === WindowNames.secondary) {
browserWindow.setBrowserView(view);
const contentSize = browserWindow.getContentSize();
view.setBounds(await getViewBounds(contentSize as [number, number], { windowName }));
Expand Down
2 changes: 1 addition & 1 deletion src/services/windows/handleCreateBasicWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function handleCreateBasicWindow<N extends WindowNames>(
});
}
await updateWindowBackground(newWindow);
// Not loading main window (like sidebar and background) here. Only load wiki in browserView in the secondary window.
// Not loading main window (like sidebar and background) here. Only load wiki in browserView in the secondary window. Secondary window will use a BrowserView to load content, and without main content like sidebar and Guide.
const isWindowToLoadURL = windowName !== WindowNames.secondary;
if (isWindowToLoadURL) {
// This loading will wait for a while
Expand Down
3 changes: 2 additions & 1 deletion src/services/windows/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export interface IWindowService {
loadURL(windowName: WindowNames, newUrl?: string): Promise<void>;
maximize(): Promise<void>;
/**
* Create a new window.
* Create a new window. Handles setup of window configs.
* See `src/services/windows/handleCreateBasicWindow.ts` for `new BrowserWindow` process.
* @param returnWindow Return created window or not. Usually false, so this method can be call IPC way (because window will cause `Failed to serialize arguments`).
*/
open<N extends WindowNames>(windowName: N, meta?: WindowMeta[N], config?: IWindowOpenConfig<N>): Promise<undefined>;
Expand Down
3 changes: 2 additions & 1 deletion src/services/workspaces/getWorkspaceMenuTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ export async function getWorkspaceMenuTemplate(
}

if (!active && !isSubWiki) {
template.splice(1, 0, {
// This is rarely used, put in the middle.
template.splice(3, 0, {
label: hibernated ? t('WorkspaceSelector.WakeUpWorkspace') : t('WorkspaceSelector.HibernateWorkspace'),
click: async () => {
if (hibernated) {
Expand Down

0 comments on commit 0258c8a

Please sign in to comment.