public static IntPtr GetWindowHandle()

in src/Services/Azure/Authentication/WindowHandleProvider.cs [17:43]


    public static IntPtr GetWindowHandle()
    {
        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            return GetForegroundWindow();
        }

        if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
        {
            try
            {
                IntPtr display = XOpenDisplay(":1");
                Console.WriteLine(display == IntPtr.Zero
                    ? "No X display available. Running in headless mode."
                    : "X display is available.");
                return display;
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.ToString());
                Console.ResetColor();
            }
        }

        return IntPtr.Zero;
    }