Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnnsrs committed Nov 27, 2024
1 parent d77f9fe commit 132cab2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 12 additions & 4 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ function openSecondaryWindow(path): void {
show: false,
autoHideMenuBar: true,
...(process.platform === "linux" ? { icon } : {}),
webPreferences: {
preload: join(__dirname, "../preload/index.js"),
sandbox: false,
},
});

secondaryWindow.on("ready-to-show", () => {
Expand All @@ -168,11 +172,15 @@ function openSecondaryWindow(path): void {
// HMR for renderer base on electron-vite cli.
// Load the remote URL for development or the local html file for production.
if (is.dev && process.env["ELECTRON_RENDERER_URL"]) {
secondaryWindow.loadURL(process.env["ELECTRON_RENDERER_URL"] + "#" + path);
secondaryWindow.loadURL(process.env["ELECTRON_RENDERER_URL"] + path);
} else {
secondaryWindow.loadFile(
join(__dirname, "../renderer/index.html", "#" + path),
);
secondaryWindow
.loadFile(join(__dirname, "../renderer/index.html"))
.then(() => {
secondaryWindow.webContents.executeJavaScript(
`window.location = '${path}'`,
);
});
}
}

Expand Down
1 change: 0 additions & 1 deletion src/components/layout/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export const PageLayout = ({
const location = useLocation();

const popOut = useCallback(() => {
console.log(location.pathname);
window.api.openSecondWindow(location.pathname);
}, []);

Expand Down

0 comments on commit 132cab2

Please sign in to comment.