@@ -126,7 +126,7 @@ function getPositionForPopup({ screen, BrowserWindow }: { screen: Screen; Browse
126
126
/** Special purpose createWindow that accepts only an argv */
127
127
function createWindowWithArgv ( executeThisArgvPlease ?: string [ ] ) {
128
128
// eslint-disable-next-line @typescript-eslint/no-use-before-define
129
- createWindow ( true , executeThisArgvPlease )
129
+ createWindow ( true , process . env , executeThisArgvPlease )
130
130
}
131
131
132
132
function getClientProductName ( ) : Promise < string > {
@@ -144,6 +144,7 @@ function getClientStyles(): Promise<BrowserWindowConstructorOptions & { defaultT
144
144
/** Open a new Electron window */
145
145
export async function createWindow (
146
146
noHeadless = false ,
147
+ env : Record < any , any > ,
147
148
executeThisArgvPlease ?: string | string [ ] ,
148
149
subwindowPlease ?: boolean ,
149
150
subwindowPrefs ?: ISubwindowPrefs ,
@@ -479,6 +480,7 @@ export async function createWindow(
479
480
case 'new-window' :
480
481
createWindow (
481
482
true ,
483
+ env ,
482
484
message . argv ,
483
485
undefined ,
484
486
{
@@ -492,7 +494,7 @@ export async function createWindow(
492
494
)
493
495
break
494
496
case 'open-graphical-shell' :
495
- createWindow ( true )
497
+ createWindow ( true , env )
496
498
break
497
499
case 'enlarge-window' :
498
500
mainWindow . setContentSize ( 1400 , 1050 , true )
@@ -533,7 +535,7 @@ export async function createWindow(
533
535
const returnValue = await mod [ message . main || 'main' ] (
534
536
message . args ,
535
537
event . sender ,
536
- ( argv : string | string [ ] , prefs ?: ISubwindowPrefs ) => createWindow ( true , argv , undefined , prefs )
538
+ ( argv : string | string [ ] , prefs ?: ISubwindowPrefs ) => createWindow ( true , env , argv , undefined , prefs )
537
539
)
538
540
debug ( 'invoke got returnValue' , returnValue )
539
541
@@ -607,10 +609,8 @@ export const getCommand = (
607
609
608
610
// re: argv.length === 0, this should happen for double-click launches
609
611
const isShell =
610
- ! process . env . KUI_POPUP &&
611
- ( argv . length === 0 ||
612
- argv . find ( _ => _ === 'shell' ) ||
613
- ( process . env . RUNNING_SHELL_TEST && ! process . env . KUI_TEE_TO_FILE ) )
612
+ ! env . KUI_POPUP &&
613
+ ( argv . length === 0 || argv . find ( _ => _ === 'shell' ) || ( env . RUNNING_SHELL_TEST && ! env . KUI_TEE_TO_FILE ) )
614
614
615
615
debug ( 'isShell' , argv , isShell )
616
616
@@ -628,12 +628,12 @@ export const getCommand = (
628
628
argv = [ 'shell' ]
629
629
subwindowPlease = false
630
630
subwindowPrefs = { cwd, env }
631
- } else if ( process . env . KUI_POPUP ) {
632
- argv = JSON . parse ( process . env . KUI_POPUP )
631
+ } else if ( env . KUI_POPUP ) {
632
+ argv = JSON . parse ( env . KUI_POPUP )
633
633
subwindowPrefs = { cwd, env }
634
634
}
635
635
636
- if ( process . env . KUI_POPUP_WINDOW_RESIZE ) {
636
+ if ( env . KUI_POPUP_WINDOW_RESIZE ) {
637
637
subwindowPrefs = {
638
638
cwd,
639
639
env,
@@ -727,11 +727,12 @@ export async function initElectron(
727
727
// Someone tried to run a second instance, open a new window
728
728
// to handle it
729
729
730
+ const env = ! additionalData . env ? process . env : JSON . parse ( additionalData . env )
730
731
const {
731
732
argv,
732
733
subwindowPlease,
733
734
subwindowPrefs : defaultSubwindowPrefs
734
- } = getCommand ( commandLine , cwd , JSON . parse ( additionalData . env ) , async ( ) => import ( 'electron' ) )
735
+ } = getCommand ( commandLine , cwd , env , async ( ) => import ( 'electron' ) )
735
736
736
737
const mySubwindowPrefs = additionalData . subwindowPrefs || defaultSubwindowPrefs
737
738
if ( ! mySubwindowPrefs . width && widthFromCaller ) {
@@ -741,8 +742,8 @@ export async function initElectron(
741
742
mySubwindowPrefs . height = heightFromCaller
742
743
}
743
744
744
- debug ( 'opening window for second instance' , commandLine , subwindowPlease , mySubwindowPrefs )
745
- createWindow ( true , argv , subwindowPlease , mySubwindowPrefs )
745
+ debug ( 'opening window for second instance' , commandLine , subwindowPlease , mySubwindowPrefs , additionalData )
746
+ createWindow ( true , env , argv , subwindowPlease , mySubwindowPrefs )
746
747
}
747
748
)
748
749
@@ -755,7 +756,12 @@ export async function initElectron(
755
756
env : JSON . stringify ( process . env ) ,
756
757
subwindowPrefs : ! subwindowPrefs
757
758
? undefined
758
- : { width : subwindowPrefs . width , height : subwindowPrefs . height , title : subwindowPrefs . title }
759
+ : {
760
+ width : subwindowPrefs . width ,
761
+ height : subwindowPrefs . height ,
762
+ title : subwindowPrefs . title ,
763
+ fullscreen : subwindowPrefs . fullscreen
764
+ }
759
765
}
760
766
761
767
if ( ! app . requestSingleInstanceLock ( additionalData ) ) {
@@ -776,7 +782,7 @@ export async function initElectron(
776
782
// Some APIs can only be used after this event occurs.
777
783
app . once ( 'ready' , ( ) => {
778
784
debug ( 'opening primary window' , command )
779
- createWindow ( true , command . length > 0 && command , subwindowPlease , subwindowPrefs )
785
+ createWindow ( true , process . env , command . length > 0 && command , subwindowPlease , subwindowPrefs )
780
786
} )
781
787
782
788
// Quit when all windows are closed.
@@ -795,7 +801,7 @@ export async function initElectron(
795
801
// On OS X it's common to re-create a window in the app when the
796
802
// dock icon is clicked and there are no other windows open.
797
803
if ( nWindows === 0 ) {
798
- createWindow ( )
804
+ createWindow ( false , process . env )
799
805
}
800
806
} )
801
807
}
0 commit comments