Skip to content

Commit d3b71e5

Browse files
authored
Merge branch 'main' into prettier-and-eslint-fixes
2 parents 0af5951 + a028946 commit d3b71e5

File tree

16 files changed

+44
-4
lines changed

16 files changed

+44
-4
lines changed

.github/workflows/fix-php-code-style-issues.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
uses: actions/checkout@v5
2424
with:
2525
ref: ${{ github.head_ref || github.sha }}
26+
fetch-depth: 0
2627

2728
- name: Check PHP code style issues
2829
if: github.event_name == 'push'

resources/electron/electron-plugin/dist/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class NativePHP {
9595
details.requestHeaders['X-NativePHP-Secret'] = state.randomSecret;
9696
callback({ requestHeaders: details.requestHeaders });
9797
});
98+
if (process.env.NATIVEPHP_NO_FOCUS) {
99+
state.noFocusOnRestart = true;
100+
}
98101
yield notifyLaravel("booted");
99102
});
100103
}

resources/electron/electron-plugin/dist/libs/positioner/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class Positioner {
7474
x: Math.floor(screenSize.x + (screenSize.width / 2 - windowSize[0] / 2)),
7575
y: Math.floor((screenSize.height + screenSize.y) / 2 - windowSize[1] / 2),
7676
},
77+
upperCenter: {
78+
x: Math.floor(screenSize.x + (screenSize.width / 2 - windowSize[0] / 2)),
79+
y: Math.floor(screenSize.y + (screenSize.height - windowSize[1]) / 3),
80+
},
7781
};
7882
if (position.substr(0, 4) === "tray") {
7983
if (positions[position].x + windowSize[0] >

resources/electron/electron-plugin/dist/server/api/window.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ router.post('/open', (req, res) => {
274274
});
275275
}
276276
window.webContents.on('did-finish-load', () => {
277+
if (state.noFocusOnRestart && window.isVisible()) {
278+
return;
279+
}
277280
window.show();
278281
});
279282
window.webContents.on('did-fail-load', (event) => {

resources/electron/electron-plugin/dist/server/state.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default {
3636
randomSecret: generateRandomString(32),
3737
processes: {},
3838
windows: {},
39+
noFocusOnRestart: false,
3940
findWindow(id) {
4041
return this.windows[id] || null;
4142
},

resources/electron/electron-plugin/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ class NativePHP {
124124
callback({ requestHeaders: details.requestHeaders });
125125
});
126126

127+
if (process.env.NATIVEPHP_NO_FOCUS) {
128+
state.noFocusOnRestart = true;
129+
}
130+
127131
await notifyLaravel('booted');
128132
}
129133

resources/electron/electron-plugin/src/libs/positioner/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ class Positioner {
7979
x: Math.floor(screenSize.x + (screenSize.width / 2 - windowSize[0] / 2)),
8080
y: Math.floor((screenSize.height + screenSize.y) / 2 - windowSize[1] / 2),
8181
},
82+
upperCenter: {
83+
x: Math.floor(
84+
screenSize.x + (screenSize.width / 2 - windowSize[0] / 2),
85+
),
86+
y: Math.floor(
87+
screenSize.y + (screenSize.height - windowSize[1]) / 3,
88+
),
89+
},
8290
};
8391

8492
// Default to right if the window is bigger than the space left.

resources/electron/electron-plugin/src/server/api/window.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ router.post('/open', (req, res) => {
409409
}
410410

411411
window.webContents.on('did-finish-load', () => {
412+
if (state.noFocusOnRestart && window.isVisible()) {
413+
return;
414+
}
415+
412416
window.show();
413417
});
414418

resources/electron/electron-plugin/src/server/state.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ interface State {
3434
randomSecret: string;
3535
store: Store;
3636
findWindow: (id: string) => BrowserWindow | null;
37+
noFocusOnRestart: boolean;
3738
dockBounce: number;
3839
}
3940

@@ -63,6 +64,7 @@ export default {
6364
randomSecret: generateRandomString(32),
6465
processes: {},
6566
windows: {},
67+
noFocusOnRestart: false,
6668
findWindow(id: string) {
6769
return this.windows[id] || null;
6870
},

resources/electron/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"@vue/eslint-config-prettier": "^10.1.0",
8181
"cross-env": "^10.0.0",
8282
"electron": "^38.0.0",
83-
"electron-builder": "^25.1.8",
83+
"electron-builder": "^26.0.0",
8484
"electron-chromedriver": "^38.0.0",
8585
"electron-vite": "^4.0.0",
8686
"eslint": "^9.17.0",

0 commit comments

Comments
 (0)