Skip to content

Commit cf95ef9

Browse files
committed
only read ForegroundShell if ShouldUseExplorerSortOrder is enabled
1 parent 19adfa1 commit cf95ef9

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

Source/ImageGlass/FrmMain/FrmMain.PicMainEvents.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,11 @@ private async Task HandlePicMainDragDropAsync(DragEventArgs e)
100100

101101

102102
// get foreground shell
103-
using var shell = new EggShell();
104-
Program.ForegroundShell = shell.GetForegroundWindowView();
103+
if (Config.ShouldUseExplorerSortOrder)
104+
{
105+
using var shell = new EggShell();
106+
Program.ForegroundShell = shell.GetForegroundWindowView();
107+
}
105108
Program.UpdateInputImagePath(filePath);
106109

107110

Source/ImageGlass/Program.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,11 @@ static void Main()
132132

133133

134134
// get foreground shell
135-
using var shell = new EggShell();
136-
ForegroundShell = shell.GetForegroundWindowView();
135+
if (Config.ShouldUseExplorerSortOrder)
136+
{
137+
using var shell = new EggShell();
138+
ForegroundShell = shell.GetForegroundWindowView();
139+
}
137140

138141
// check and run Quick setup
139142
if (CheckAndRunQuickSetup()) return;
@@ -332,9 +335,11 @@ private static void ActivateWindow(string[] args)
332335

333336

334337
// get foreground shell
335-
using var shell = new EggShell();
336-
ForegroundShell = shell.GetForegroundWindowView();
337-
338+
if (Config.ShouldUseExplorerSortOrder)
339+
{
340+
using var shell = new EggShell();
341+
ForegroundShell = shell.GetForegroundWindowView();
342+
}
338343

339344
// load image file from arg
340345
Local.FrmMain.LoadImagesFromCmdArgs(args);

0 commit comments

Comments
 (0)