This layer builds our final executable, and contains all the logic for manipulating our Win32 window, as well as hosting a XAML island for our XAML content. In this figure, the top, orange box is our Win32 layer. Architectureįor a more detailed breakdown of Windows Terminal’s architecture, let’s refer to the following diagram: We’ve also been able to use the power of UWP XAML and WinUI 2 to help build the UI of Terminal quickly and beautifully. As a Win32 application, we’re able to use all of the legacy Win32 APIs that a terminal app might need to launch processes and query the filesystem. This model allows Terminal to get the best of both worlds. For all it knows, it’s just a normal C++/WinRT UWP application. This layer doesn’t even know that it’s being hosted by a Win32 window. The bulk of the application which is built as a UWP XAML Application that uses WinUI 2. What we ended up building was an application that was composed of two parts:Ī thin Win32 window that is mostly just responsible for drawing a window to the screen and starting up the XAML Hosting infrastructure As it turns out, this was exactly what we needed. XAML Islands would enable a traditional Win32-style application to host UWP XAML content within its window without the traditional restrictions of a UWP application. Just down the hall from us was the WinUI team, and little did we know, they had been building XAML Islands for the better part of the previous year. ![]() XAML Islandsįortunately for us, the solution was actually closer than we thought. (In fact, many of these discussions helped lead to the effort now known as “ Project Reunion“, as well as the WinUI 3 effort that extends the modern UI framework to Desktop apps). However, most of the routes we pursued ended up either as a gaping security hole, or as something that would require years of effort across the organization. We tried pushing on allowing UWP apps to run outside the app container. We considered options like a special restricted capability for launching full-trust processes from a UWP. We spent a good portion of that year discussing our options with a number of teams across the Windows organization. Could you imagine using your shell without being able to change directories, read file contents, or launch any other processes that you could interact with? Obviously, this was a non-starter for us. Therefore, if we wanted to build Terminal as a UWP app in 2018, then any of the shells that we would spawn (like cmd.exe, powershell.exe or bash) would be unable to do anything to the system. They’re allowed to launch external processes, but these external processes are additionally bound by the same restrictions the app is bound to. They’re not even allowed to change their working directory. These UWP apps are all launched inside a “low integrity app container”, which basically means they have effectively no permissions on the OS. These security features ensured that UWP apps delivered by the Microsoft Store were unable to access restricted locations within the OS, or leave artifacts laying around on disk, to simplify the uninstall process. At the time, “UWP applications” had special restrictions placed on them by the OS. ![]() That would immediately grant us access to UWP XAML and the whole WinUI 2 library, which has native controls, styles, and capabilities built specifically for Windows apps. We made the choice to build Windows Terminal as a UWP application. We wanted to make sure that it was visually consistent with other inbox applications and followed Fluent Design principles. When we were in the earliest planning stages for Terminal, we knew right off the bat that we wanted to be able to build a modern application that used the best features the Windows platform had to offer. We knew that we wanted to have conpty be able to power a new terminal application, allowing us to build a new user experience for the command line on Windows. We, as the Windows Terminal team, had just started getting conpty into a place that was good enough to be useful as a translation layer between the console and a terminal application. This was around the time the first prototyping of the application that would become Windows Terminal began. The history of WinUI and Windows Terminal goes back to December 2017. This blog post goes into the history and architecture of how these two technologies came together. WinUI and Windows Terminal have a strong relationship that goes back to the origins of Windows Terminal.
0 Comments
Leave a Reply. |