Graphical User Interface "Always add a commandline interface to your software. Graphical User interfaces are for sissies." --[1]bitreich manifesto Graphical user interface (GUI) is a visual [2]user interface that uses graphics such as images and geometrical shapes. This stands in contrast with [3]text user interface (TUI) which is also visual but only uses text for communication. Expert computer users normally frown upon GUI because it is the "noobish", inefficient, limiting, cumbersome, hard to automate way of interacting with computer. GUI brings [4]complexity and [5]bloat, they are slow, inefficient and distracting. We try not to use them and prefer the [6]command line. "[7]Modern" GUIs mostly use [8]callback-based programming, which again is more complicated than standard polling non-interactive I/O. If you need to do GUI, just use a normal infinite loop FFS. When And How To Do GUI GUI is not forbidden, it has its place, but today it's way too overused -- it should be used only if completely necessary (e.g. in a painting program) or as a completely optional thing built upon a more [9]suckless text interface or [10]API. So remember: first create a program and/or a [11]library working without GUI and only then consider creating an optional GUI [12]frontend. GUI must never be tied to whatever functionality can be implemented without it. Still, when making a GUI, you can make it [13]suckless and lighthweight. Do your buttons need to have reflections, soft shadows and rounded anti-aliased borders? No. Do your windows need to be transparent with light-refraction simulation? No. Do you need to introduce many MB of dependencies and pain such as [14]QT? No. The ergonomics and aesthetic design of GUIs has its own field and can't be covered here, but just keep in mind some basic things: * Don't have too many elements (buttons etc.) at the screen at once, it's confusing as hell and drives noobs away. * Things must be intuitive, i.e. behave in a way that they normally do (e.g. main menu should be at the top of the window, not the bottom etc.). * Just use your brain. If a button is important and often used, it should probably be bigger than a button that's used almost never, etc. The million dollar question is: which GUI framework to use? Ideally none. GUI is just pixels, buttons are just rectangles; make your GUI simple enough so that you don't need any shitty abstraction such as widget hierarchies etc. If you absolutely need some framework, look for a suckless one; e.g. [15]nuklear is worth checking out. The suckless community sometimes uses pure [16]X11, however that's not ideal, X11 itself is kind of bloated and it's also getting obsoleted by [17]Wayland. The ideal solution is to make your GUI backend agnostic, i.e. create your own very thin abstraction layer above the backend (e.g. X11) so that any other backend can be plugged in if needed just by rewriting a few simple functions of your abstraction layer (see how e.g. [18]Anarch does rendering). State Of Mainstream GUI Nowadays there are a great many GUI [19]libraries, [20]frameworks, standards and [21]paradigms, and it may be a bit hard to digest them at once. TODO: some general shit bout graphical windows vs the "single window" mobile and web UI, analysis of the "GUI stack" (Linux framebuffer, X window, widget toolkits etc.), basic widgets etc. Links: 1. bitreich.md 2. ui.md 3. tui.md 4. complexity.md 5. bloat.md 6. cli.md 7. modern.md 8. callback.md 9. suckless.md 10. api.md 11. library.md 12. frontend.md 13. suckless.md 14. qt.md 15. nuklear.md 16. x11.md 17. wayland.md 18. anarch.md 19. library.md 20. framework.md 21. paradigm.md