Skip to content
Open
Changes from all 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
49 changes: 20 additions & 29 deletions index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const background = async () => {

window.addEventListener("unload", async () => {
await Promise.all([
nativeWindow.destroy({ ref: asideMainWin }),
nativeWindow.destroy({ ref: spotlightWin }),
nativeWindow.destroy(asideMainWin),
nativeWindow.destroy(spotlightWin),
]);
});
};
Expand All @@ -55,36 +55,30 @@ const createWindowView = async (action, win, args) => {

const loadViewURL = async (win, view, { url, action }) => {
if (action === "addBrowserView") {
await nativeWindow.addBrowserView({ ref: win, viewRef: view });
await nativeWindow.addBrowserView(win, view);
} else {
await nativeWindow.setBrowserView({ ref: win, viewRef: view });
await nativeWindow.setBrowserView(win, view);
}

const viewContents = await views.getWebContents({ ref: view });
await webContents.loadURL({ ref: viewContents }, url);
const viewContents = await views.getWebContents(view);
await webContents.loadURL(viewContents, url);
};

const setViewBounds = async (win, view, { x, y, w, h }) => {
const [currWidth, currHeight] = await nativeWindow.getSize({ ref: win });

await views.setBounds({
ref: view,
bounds: {
x: Math.round(currWidth * x),
y: Math.round(currHeight * y),
width: Math.round(currWidth * w),
height: Math.round(currHeight * h),
},
const [currWidth, currHeight] = await nativeWindow.getSize(win);

await views.setBounds(view, {
x: Math.round(currWidth * x),
y: Math.round(currHeight * y),
width: Math.round(currWidth * w),
height: Math.round(currHeight * h),
});

await views.setAutoResize({
ref: view,
dimensions: {
width: true,
height: true,
horizontal: true,
vertical: true,
},
await views.setAutoResize(view, {
width: true,
height: true,
horizontal: true,
vertical: true,
});
};

Expand All @@ -106,12 +100,9 @@ subscribe("workspace:selected", async ({ title }) => {
partition: `memory:${title}`,
});

await nativeWindow.setTitle({ ref: spotlightWin, title });
await nativeWindow.setTitle(spotlightWin, title);
if (selectedWorkspace) {
await nativeWindow.removeBrowserView({
ref: asideMainWin,
viewRef: selectedWorkspace,
});
await nativeWindow.removeBrowserView(asideMainWin, selectedWorkspace);
}

selectedWorkspace = await createWindowView("addBrowserView", asideMainWin, {
Expand Down