 All right. Thank you for coming. My name is Miguel de Casa and I've been working on open source for many years. I first started contributing to Linux and the GNU project in 1992. I built a company to build the open source software and we tried and it was very rough. It was very difficult to keep your friends employed with open source. We built a proprietary company which led to a little of a disagreement with Richard Stallman. So he kicked me out of the foundation. Then I went to build another company, which this time I ran at the end and tried to do open source. We had a lot of fun in that company. We specialized on mobile, on Android and iOS development, Linux, Mono at an era where Microsoft was not very well-welcome in the open source world. Then two things happened. They changed the CEO. We went from Steve Balmer which was a sales guy, very aggressive, not very open to ideas about open source, and we went to Sacha Nadella who is a completely different person. A man that likes to read a lot of books and have his opinions challenged. He decided to embrace open source and he decided to embrace free software. So I was running this company with my friend, Nat Friedman and Microsoft Aquartus in 2016. The first thing that Microsoft did is they turned our proprietary very expensive proprietary products into open source products. So to give an idea, each license per seat was $2,000, and we were selling them like hot pancakes or hot waffles, as you would say here. The first thing that Sacha and Scott got through did is like, we're going to open source all this stuff. This is now public work. So ironically, it was Sacha Nadella and Scott got through that brought me back to the open source world after all these years. Anyways, since I've been working in 1992 on Linux or Mac OS, I've always used this. I've probably have one running here right now. Let me see if I have one. Oh, the machine just rebooted so you won't see it. But this is my file manager. It's a file manager that I started writing in 1992. It's called the Midnight Commander. It's still branded GNOME Midnight Commander from when Richard liked me. I spend my life in this thing. Usually I have dozens of instances of this file manager. Despite the fact that I started the GNOME project, that I use the Mac every day, I still spend most of my days in the Linux shell. This is my life. This is where I spend my life. This is where I do all my file operations, how I keep my life organized, and it's done wonders. It is a clone of a DOS app. So this was a clone of a DOS app that I missed when Linux came on the market. I said, I got to have this. I understand Linux philosophy but give me my shell. So I want to build this thing. So this is my life and what I want to talk to you about today is really a pet project of mine that has nothing to do with my commercial offerings or anything that I've done in the past. This is just my evening hack, is the thing that I do on the afternoons. I'm doing this talk because the person that was going to do this talk didn't show up. So they were going to do a very similar talk about building user interface applications with .NET. It was going to be a competing framework, and because I was the chair of the session, I figured it would be unfair to compete with him. So I said, let's do this talk, but then he withdrew. So I think it's fair. So this is my favorite tech user interfaces. This is the first machine that I started working on at the university with my dad. It was a deck VT100. That was a keyboard with a detachable keyboard. It does the most beautiful scrolling you've ever seen. Now, most of you don't know what, I bet none of you have seen one of those or used one of those. So you don't appreciate what these beautiful smooth scrolling is. But today, the same technology that power that thing, and evolution of this set of escape sequences and the way you communicate with a terminal is what is used on consoles on Windows, Mac, and Linux. I'm still very much in love with that, and I still use this to live a day. So I decided to build a UI toolkit that would let me build applications for the console, and it is relatively painful. I'm shortening this talk. It's a much longer talk, but it's very painful to build these console applications on Linux because you need to learn a lot about curses, about input, about extra consoles, the Windows console. If you want to build something that works across the board, it's relatively annoying to do and get it right. There's complications in terms of colors and mouse support. So one day I decided that I had it, and I wanted to build something for me. So this is a project that I built just for me. Now, this UI that you see this there is implemented with this code, with this C-sharp code. It leverages some of the idioms that are common in C-sharp, like for example, this nested creation of objects, this Lambda functions that attached an action to a menu. For example, when you press a quit menu, it invokes this function, so this is a full statement there. That's a UI that you get for that. So I'm going to tell you a little bit about how this works. So what you need to remember is that for the past almost 10 years, for the past 10 years, I've been working mostly on bringing .NET to Android and iOS. So my view of what a UI toolkit should be has been influenced by iOS and Android extensively. You don't know this, you don't know this, we're going to get this fixed eventually. You don't know this, but one of the original window managers that was used by the GNOME desktop when we launched, who here is old enough? Who was born before 1990? So when we launched this thing, we launched this in 1999. Who was 15 in 1999? At least a couple. So when we launched GNOME, we launched with this window manager, it was a fabulous window manager, super configurable, it was written in a variation of Lisp, it was called Sophish. This window manager was built by none other than Harrop, and he went to build the core animation framework that powers every iPhone. So every time that you see a buttery smooth UI on the iPhone, that guy came from GNOME, but he went to Apple and he landed all of those ideas. So all the animation frameworks and all the smoothness on Apple came from this guy from the GNOME universe. Anyways, so when I was building this retro user interface that was influenced mostly by the iOS UI design system and how it works. So I wanted to blend some of the things that you wanted to do on a text user interface and some of the ideas that come from iOS. So first of all, let's start with what every modern UI application framework has this time transported to the console, to a raw console is we do have a main loop. What that does is it handles your input, that can be keyboard, it can be the mouse, it can be file descriptors, it handles timers, it handles idle events. So there's a whole infrastructure that you've come to expect from things like QT or GTK or WPF or iOS. This is, I don't know. Clearly it's proprietary software that is failing me. Is there some sort of, all right. It has a whole system of redrawing damages damage regions of the screen. This is all handled by the application.run. The second piece that is interesting is that I copy the design from iOS for views. This in my opinion is one of the most powerful things that iOS has which is anything that goes into the screen is called a view. There are certain attributes as to whether they can take input or not input, but views themselves are not leaps. Any view can contain further views inside. So you can use them as a leaf or as a building block, and everything is built on top of a view. This is roughly how you compose them, right? So you just nest these things. You nest these things and you need to have a system that handles the focus and handles how the focus is going to work when you tab it and how you write the events. So a lot of what this library does is handling those for you. It lets you, like I said, build these nested user interfaces the same way that iOS does. So what I'm saying is this is the iOS of terminal applications. Now, there are three fundamental types. These are very simple, but we'll come to this in a second because this is the one area where I think that I am much better than all the garbage that Apple did with iOS, which is a rectangle points and sizes. I say that it's garbage because they built a layout system that requires a PhD. The other day, somebody on Twitter said, oh, you're a great programmer. I wish I was like you, and I said, you have not seen me struggle for the last three weeks trying to get a layout on the screen with auto layout. It is so embarrassing that I have not published the Git repo. I've kept it secret because I can't get this thing to work. So it's probably going to take me another week and then I'll publish it, but it's been a world of misery. So this is the layout system for people like me, people in their 40s that they can't really do these things anymore. Life is too short. We have two sets of layout positioning. The first one is you say, I want you to be from 0,0 to 10,10. That's what it is, no questions asked, and off you go. The second one is this marked positioning, which the X and Y properties are not integers. They belong to this type called pause. The width and height are defined in terms of this type called dimension. It just happens to that we create an implicit conversion from integers to those. So you can always say X equals 10 and it will fix it. So for those of you of my age, you can just get it done that way, or people in the enterprise. But this is the magic and pay attention. This is really the magic. There are a couple of operations here. You can create these pause objects with a number of things, like for example pause with the percent method. These are all static methods. God damn it. These are all static methods. So you can say I want a percentage. So you say pause.percent 10, and it will give you a position that will be 10 percent of the container. Anchor N means I want this position to be attached to the end of my container with this much buffer space, the margin there which is a default option. I want this to be centered, and this is centered compared to my container. Remember, every view is nested. So this is always compared to the previous one. This is implicit operation that I mentioned. You can also operate on this thing. So you can take a position is 10 percent plus 10 units plus centers. You can say center plus 10 percent plus five units, for example. So you can add these up and you can subtract those up. You can also use this anchor point. So you can say the positions to the left, to the right, and then add offsets to them if you want to. Or you can have positions that are relative to other views. So you can say this is a position that needs to be anchored to this other view. So I don't know whether you're putting the other view on the screen, just make me relative to that either to the left or the right center or whatever. So the same thing goes for dimensions. It doesn't have as many operations, but again, you can describe operations in terms of, I want you to fill up all the available space, or be a percentage of the space. The same thing is the important one. Again, you get these combination operators. I think it's probably one of the best ideas that I've had in many, many years. This is what it looks like. So are you doing a login password and a couple of other things? You can see that first I started to, I said I want to center this piece in the X dimension on the screen and the Y, I fixed it. Now, notice what I do with the next one. I said, well, I want the left position to be the left one of the parent one. So now I don't need to worry where it goes. What is interesting is that it is the login that gets centered. It is a login that gets centered and whatever that ends up, and the password is just going to be below. So it's not going to be centered, it's not going to be on the side, it's going to be attached below. You can see a couple more examples. The Y basically says, I want you to be one line below, so attach to the bottom, add one line. Jesus, I'm very sorry about this. I don't know what's going on. Maybe there's some timer, auto timer going on? What? All right. Well, I hope you enjoy this. A couple of other things. I'm not going to go into this, but you get the idea. There's a couple of things that are worth keeping in mind which is that because VT100s that are still induced, usually when you have a poor terminal, they do not have a lot of colors. In terminals that have a lot of colors, you really shouldn't be thinking about colors. You really need to be thinking about attributes. So to make things simple, I've introduced an attribute system that can define these things. I'll give you an example. This is a regular UI, and you don't really think about setting the colors for these ones. Instead, you need to think about which colors you're going to use for normal text, for the hot key, for the normal text, the focus key, and the hot focus key. These are things that you need to do that typically in a GUI UI, you no longer have to do. Do not worry, we do have color schemes already built for you. So you don't have to think about this thing, you just pick a style. Now, I would like one day to bring some sort of CSS-like system so that it's easier to customize. Right now, you have to kind of like an animal say, this is the black and white settings, and these are the full color settings, and this is the 255-color settings. But anyways, there's a ton of views that you can use today. So, and they're super easy to build. So feel free to use it or not, and we have convenient things for creating dialogues, pop-up boxes, message boxes, your file-saved dialogues, et cetera. So anyways, this is my new toy. This is my new toy. The last thing that I want to finish with is, this is just a warning for us if you're doing multi-thread applications, but when we build mobile app frameworks, we build this cross-platform UI toolkit called Xamarin Forms, which is you build it once, and it runs on Android, iOS, Mac, WPF, et cetera, right? And this guy, God damn it, Javier, Javier from Spain went and ported our UI toolkit to the console. So this is, again, the XAML that you were seeing a minute ago in the talk about F-sharp or the WebAssembly talk, you can use that and generate console applications from that. So thank you very much, folks.