Skip to content

Add endpoint to resize MenuBar window #163

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

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions resources/js/electron-plugin/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class NativePHP {
constructor() {
this.processes = [];
this.schedulerInterval = undefined;
this.mainWindow = null;
}
bootstrap(app, icon, phpBinary, cert) {
initialize();
Expand Down Expand Up @@ -66,6 +67,16 @@ class NativePHP {
}
event.preventDefault();
});
if (process.platform === 'win32') {
app.on('second-instance', (event, commandLine, workingDirectory) => {
if (this.mainWindow) {
if (this.mainWindow.isMinimized())
this.mainWindow.restore();
this.mainWindow.focus();
}
this.handleDeepLink(commandLine.pop());
});
}
}
bootstrapApp(app) {
return __awaiter(this, void 0, void 0, function* () {
Expand Down Expand Up @@ -124,6 +135,13 @@ class NativePHP {
else {
app.setAsDefaultProtocolClient(deepLinkProtocol);
}
if (process.platform === 'win32') {
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
app.quit();
return;
}
}
}
}
startAutoUpdater(config) {
Expand Down
5 changes: 5 additions & 0 deletions resources/js/electron-plugin/dist/server/api/menuBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ router.post("/hide", (req, res) => {
res.sendStatus(200);
state.activeMenuBar.hideWindow();
});
router.post("/resize", (req, res) => {
res.sendStatus(200);
const { width, height } = req.body;
state.activeMenuBar.window.setSize(width, height);
});
router.post("/create", (req, res) => {
res.sendStatus(200);
let shouldSendCreatedEvent = true;
Expand Down
8 changes: 8 additions & 0 deletions resources/js/electron-plugin/src/server/api/menuBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ router.post("/hide", (req, res) => {
state.activeMenuBar.hideWindow();
});

router.post("/resize", (req, res) => {
res.sendStatus(200);

const { width, height } = req.body;

state.activeMenuBar.window.setSize(width, height);
});

router.post("/create", (req, res) => {
res.sendStatus(200);

Expand Down
Loading