@@ -269,7 +269,10 @@ export class WindowsStateHandler extends Disposable {
269
269
270
270
getNewWindowState ( configuration : INativeWindowConfiguration ) : INewWindowState {
271
271
const state = this . doGetNewWindowState ( configuration ) ;
272
- const windowConfig = this . configurationService . getValue < IWindowSettings | undefined > ( 'window' ) ;
272
+ // --- Start Positron ---
273
+ // const windowConfig = this.configurationService.getValue<IWindowSettings | undefined>('window');
274
+ const windowConfig = this . getWindowSettingsConfig ( ) ;
275
+ // --- End Positron --
273
276
274
277
// Fullscreen state gets special treatment
275
278
if ( state . mode === WindowMode . Fullscreen ) {
@@ -385,7 +388,10 @@ export class WindowsStateHandler extends Disposable {
385
388
state . y = Math . round ( displayToUse . bounds . y + ( displayToUse . bounds . height / 2 ) - ( state . height ! / 2 ) ) ;
386
389
387
390
// Check for newWindowDimensions setting and adjust accordingly
388
- const windowConfig = this . configurationService . getValue < IWindowSettings | undefined > ( 'window' ) ;
391
+ // --- Start Positron ---
392
+ // const windowConfig = this.configurationService.getValue<IWindowSettings | undefined>('window');
393
+ const windowConfig = this . getWindowSettingsConfig ( ) ;
394
+ // --- End Positron ---
389
395
let ensureNoOverlap = true ;
390
396
if ( windowConfig ?. newWindowDimensions ) {
391
397
if ( windowConfig . newWindowDimensions === 'maximized' ) {
@@ -418,6 +424,26 @@ export class WindowsStateHandler extends Disposable {
418
424
return state ;
419
425
}
420
426
427
+ // --- Start Positron ---
428
+ /**
429
+ * Retrieves the window settings configuration object from the configuration service and ensures
430
+ * that the newWindowDimensions property is updated with Positron's default config changes.
431
+ * @returns The window settings configuration object, or undefined if it doesn't exist.
432
+ */
433
+ private getWindowSettingsConfig ( ) {
434
+ const windowConfig = this . configurationService . getValue < IWindowSettings | undefined > ( 'window' ) ;
435
+ const updatedWindowConfig = {
436
+ ...( windowConfig ? windowConfig : { } ) ,
437
+ // We've changed the default value of newWindowDimensions to 'inherit' in Positron, so we need to
438
+ // set it to 'inherit' if it unset in the config, as we'll fallthrough to the default window state otherwise.
439
+ // Search for `window.newWindowDimensions` in src/vs/workbench/electron-sandbox/desktop.contribution.ts
440
+ // for the default configuration.
441
+ newWindowDimensions : windowConfig ?. newWindowDimensions || 'inherit' ,
442
+ } ;
443
+ return updatedWindowConfig ;
444
+ }
445
+ // --- End Positron ---
446
+
421
447
private ensureNoOverlap ( state : IWindowUIState ) : IWindowUIState {
422
448
if ( this . windowsMainService . getWindows ( ) . length === 0 ) {
423
449
return state ;
0 commit comments