uid: Terminal.Gui.Drivers
Drivers namespace provides cross-platform terminal abstraction and console driver implementations.@Terminal.Gui.Drivers contains the platform abstraction layer that enables Terminal.Gui to run consistently across Windows, macOS, and Linux/Unix systems. This namespace includes console drivers, component factories, input/output processors, and platform-specific optimizations.
The driver system handles low-level terminal operations including cursor management, color support detection, input processing, screen buffer management, and terminal size monitoring. It provides a unified API through IConsoleDriver while accommodating the unique characteristics of different terminal environments.
Terminal.Gui v2 uses a modular driver architecture based on the Component Factory pattern:
IConsoleDriver and IConsoleDriverFacade
Key, MouseEventArgs)Terminal.Gui provides three console driver implementations optimized for different platforms:
dotnet, NetComponentFactory) - Cross-platform driver using .NET System.Console API. Works on all platforms.windows, WindowsComponentFactory) - Windows-optimized driver using Windows Console APIs for enhanced performance and features.unix, UnixComponentFactory) - Unix/Linux/macOS-optimized driver using platform-specific APIs.fake, FakeComponentFactory) - Mock driver for unit testing.The appropriate driver is automatically selected based on the platform. Windows defaults to WindowsDriver, while Unix-based systems default to UnixDriver.
// Driver selection is typically automatic
Application.Init();
// Access current driver
IConsoleDriver driver = Application.Driver;
bool supportsColors = driver.SupportsTrueColor;
// Explicitly specify a driver
Application.ForceDriver = "dotnet";
Application.Init();
// Or pass driver name to Init
Application.Init(driverName: "unix");
The driver architecture uses a multi-threaded design:
This separation ensures responsive input handling even during intensive UI operations.
See the Cross-Platform Driver Model for comprehensive details.