File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
src/Sidekick.Common.Platform/Windows/Processes Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,19 @@ public string? ClientLogPath
8989 }
9090 else
9191 {
92- PreviousFocusedWindow = null ;
92+ // Try to get the process name as a fallback
93+ try
94+ {
95+ var hWnd = User32 . GetForegroundWindow ( ) ;
96+ User32 . GetWindowThreadProcessId ( hWnd , out var processId ) ;
97+ var process = Process . GetProcessById ( ( int ) processId ) ;
98+ logger . LogDebug ( "Fallback to process name: {0}" , process . ProcessName ) ;
99+ PreviousFocusedWindow = process . ProcessName ;
100+ }
101+ catch ( Exception )
102+ {
103+ PreviousFocusedWindow = null ;
104+ }
93105 }
94106
95107 return PreviousFocusedWindow ;
@@ -102,7 +114,7 @@ public bool IsPathOfExileInFocus
102114 {
103115 var focusedWindow = GetFocusedWindow ( ) ;
104116
105- // logger.LogDebug("[ProcessProvider] Current focused window title: {0}", focusedWindow);
117+ logger . LogDebug ( "[ProcessProvider] Current focused window title: {0}" , focusedWindow ) ;
106118 return focusedWindow is PATH_OF_EXILE_TITLE or PATH_OF_EXILE_2_TITLE ;
107119 }
108120 }
You can’t perform that action at this time.
0 commit comments