public ExternalApplication?GetForegroundApplication() { using var window = SystemWindow.GetForegroundWindow(); using var process = window?.GetProcess(); var executableFilePath = process?.GetExecutableFilePath(); return(!string.IsNullOrWhiteSpace(executableFilePath) ? new ExternalApplication(executableFilePath) : null); }
public bool IsForegroundApplicationFullScreen() { using var window = SystemWindow.GetForegroundWindow(); return(window != null && window.IsVisible() && !window.IsSystemWindow() && window.IsFullScreen()); }