@@ -42,7 +42,7 @@ private static void Main()
4242 WinRT . ComWrappersSupport . InitializeComWrappers ( ) ;
4343
4444 var proc = Process . GetCurrentProcess ( ) ;
45- var alwaysOpenNewInstance = ApplicationData . Current . LocalSettings . Values . Get ( "AlwaysOpenANewInstance " , false ) ;
45+ var OpenTabInExistingInstance = ApplicationData . Current . LocalSettings . Values . Get ( "OpenTabInExistingInstance " , true ) ;
4646 var activatedArgs = AppInstance . GetCurrent ( ) . GetActivatedEventArgs ( ) ;
4747
4848 if ( activatedArgs . Data is ICommandLineActivatedEventArgs cmdLineArgs )
@@ -76,7 +76,7 @@ private static void Main()
7676
7777 // Always open a new instance for OpenDialog, never open new instance for "-Tag" command
7878 if ( parsedCommands is null || ! parsedCommands . Any ( x => x . Type == ParsedCommandType . OutputPath ) &&
79- ( ! alwaysOpenNewInstance || parsedCommands . Any ( x => x . Type == ParsedCommandType . TagFiles ) ) )
79+ ( OpenTabInExistingInstance || parsedCommands . Any ( x => x . Type == ParsedCommandType . TagFiles ) ) )
8080 {
8181 var activePid = ApplicationData . Current . LocalSettings . Values . Get ( "INSTANCE_ACTIVE" , - 1 ) ;
8282 var instance = AppInstance . FindOrRegisterForKey ( activePid . ToString ( ) ) ;
@@ -102,7 +102,7 @@ private static void Main()
102102 }
103103 }
104104
105- if ( ! alwaysOpenNewInstance )
105+ if ( OpenTabInExistingInstance )
106106 {
107107 if ( activatedArgs . Data is ILaunchActivatedEventArgs launchArgs )
108108 {
@@ -117,7 +117,8 @@ private static void Main()
117117 else if ( activatedArgs . Data is IProtocolActivatedEventArgs protocolArgs )
118118 {
119119 var parsedArgs = protocolArgs . Uri . Query . TrimStart ( '?' ) . Split ( '=' ) ;
120- if ( parsedArgs . Length == 2 && parsedArgs [ 0 ] == "cmd" ) // Treat as command line launch
120+ if ( ( parsedArgs . Length == 2 && parsedArgs [ 0 ] == "cmd" ) ||
121+ parsedArgs . Length == 1 ) // Treat Win+E & Open file location as command line launch
121122 {
122123 var activePid = ApplicationData . Current . LocalSettings . Values . Get ( "INSTANCE_ACTIVE" , - 1 ) ;
123124 var instance = AppInstance . FindOrRegisterForKey ( activePid . ToString ( ) ) ;
0 commit comments