The Anatomy of the Modern Window Manager a Case Study in Developing a Novel Top-Level Reparenting List-Based Tiling Window Manager for X in an Agile Manner
Total Page:16
File Type:pdf, Size:1020Kb
Bachelor thesis Computing Science Radboud University The anatomy of the modern window manager A case study in developing a novel top-level reparenting list-based tiling window manager for X in an Agile manner Author: First supervisor/assessor: Max van Deurzen dr. Cynthia Kop s4581903 [email protected] Second supervisor: dr. Peter Achten [email protected] 2019 Abstract At the heart of the modern personal computer experience lies the desktop environment, an implemen- tation of the desktop metaphor comprising a variety of programs that together provide common graphical user interface components. Arguably the most complex and, in some systems, the most important com- ponent of the desktop environment, is the window manager. A window manager is system software that controls the placement and appearance of windows within a graphical user interface. In this thesis we describe the functioning of top-level window managers. We showcase what common features window managers may consist of, and what their interaction with other system software looks like. In doing so, we will discuss the X Window System[1], along with the Inter-Client Communication Conventions Manual[2] (ICCCM) and Extended Window Manager Hints[3] (EWMH), two standard protocols that define policy on top of the X Window System. Together, they form an environment that facilitates the interoperability between window managers and other, regular programs. As a proof of concept, we provide and discuss kranewm, a complete C++ implementation of an ICCCM and EWMH compliant top-level reparenting, tiling window manager, built on top of the X Window System, using Xlib as client-side programming library. With it, we illustrate the low-level functioning of modern top-level window management. Leading up to an extensive demonstration of the product, we review several Agile software development concepts that were applied throughout, before describing the process undergone to realize the implementation. Acknowledgements I would like to thank both of my supervisors, dr. Cynthia Kop and dr. Peter Achten, for guiding me through the research process, for the many incremental proofreads, and for the suggestions made during the development phase of kranewm. Contents 1 Introduction 4 2 Window Management 5 2.1 Windowing systems ...................................... 5 2.1.1 Graphical user interface ................................ 5 2.1.2 Display server ..................................... 5 2.1.3 Widget toolkits .................................... 6 2.2 The window manager ..................................... 6 2.2.1 Responsibilities .................................... 7 2.2.2 Stacking ........................................ 7 2.2.3 Tiling ......................................... 7 2.2.4 Compositing ...................................... 11 2.2.5 Reparenting ...................................... 12 3 The X Window System 14 3.1 History ............................................. 14 3.2 Client-server architecture ................................... 14 3.3 System model ......................................... 15 3.4 Core protocol ......................................... 15 3.5 Client-side libraries ....................................... 15 3.6 Graphical environment ..................................... 16 3.7 Resources and identifiers ................................... 17 3.8 Messages ............................................ 18 3.8.1 Events ......................................... 18 3.9 Color .............................................. 19 3.10 Graphics operations ...................................... 20 3.10.1 Images ......................................... 20 3.10.2 Text .......................................... 20 3.10.3 Exposures ....................................... 21 3.11 Fonts .............................................. 21 3.12 Input .............................................. 21 3.13 Properties and atoms ..................................... 23 3.14 The X window manager .................................... 24 3.15 Wayland ............................................ 25 3.15.1 Architecture ...................................... 25 4 Policy in X 27 4.1 ICCCM ............................................. 27 4.1.1 Client properties .................................... 28 4.1.2 Window manager properties ............................. 30 4.2 EWMH ............................................. 35 4.2.1 Non-ICCCM features ................................. 35 4.2.2 Root window protocol definitions ........................... 37 4.2.3 Client window protocol definitions .......................... 40 5 Agile Software Development 44 5.1 Agile Manifesto ........................................ 44 5.2 Extreme Programming .................................... 44 5.3 Personal Software Process ................................... 45 5.4 Personal XP .......................................... 46 6 Implementation Process 48 6.1 The planning game ...................................... 48 Max van Deurzen Page 1 of 79 Case Study in Top-Level Window Management Contents 6.2 Small releases ......................................... 49 6.3 Metaphor ........................................... 49 6.4 Simple design ......................................... 50 6.5 Testing ............................................. 50 6.6 Refactoring ........................................... 51 6.7 Pair programming ....................................... 51 6.8 Collective ownership ...................................... 51 6.9 Continuous integration .................................... 51 6.10 40-hour week ......................................... 52 6.11 On-site customer ....................................... 52 6.12 Coding standard ........................................ 52 7 Implementation Product 53 7.1 Design ............................................. 53 7.2 Reparenting .......................................... 53 7.3 Workspaces .......................................... 54 7.4 Sidebar and struts ....................................... 55 7.5 Key bindings .......................................... 56 7.6 Mouse bindings ........................................ 57 7.7 General usage ......................................... 57 7.7.1 Terminal ........................................ 57 7.7.2 Program launching .................................. 57 7.7.3 Closing clients ..................................... 57 7.8 Window states ......................................... 57 7.8.1 Floating state ..................................... 57 7.8.2 Fullscreen state .................................... 58 7.9 Window manipulation ..................................... 58 7.9.1 Inner-workspace focus movement ........................... 58 7.9.2 Inner-workspace window movement .......................... 59 7.9.3 Cross-workspace window movement ......................... 60 7.10 Layouts ............................................. 60 7.10.1 Floating mode ..................................... 60 7.10.2 Tile mode ....................................... 60 7.10.3 Stick mode ...................................... 60 7.10.4 Deck modes ...................................... 61 7.10.5 Grid mode ....................................... 61 7.10.6 Pillar mode ...................................... 62 7.10.7 Column mode ..................................... 62 7.10.8 Monocle mode ..................................... 62 7.10.9 Center mode ...................................... 63 7.11 Rules .............................................. 63 7.11.1 Centering ....................................... 64 7.11.2 Autoclosing ...................................... 64 7.11.3 Workspace hint blocking ............................... 64 7.12 Process jumping ........................................ 64 7.13 Marking ............................................ 65 7.14 Summary ............................................ 65 8 Related Work 66 9 Conclusions 67 A List-based Tiling Window Managers 71 A.1 wmii .............................................. 71 A.2 dwm .............................................. 72 A.3 awesome ............................................ 73 Max van Deurzen Page 2 of 79 Case Study in Top-Level Window Management Contents A.4 xmonad ............................................ 73 B Tree-based Tiling Window Managers 75 B.1 i3 ................................................ 75 B.2 bspwm ............................................. 76 B.3 herbstluftwm .......................................... 77 C X.Org Foundation Distribution 79 Max van Deurzen Page 3 of 79 Chapter 1 Introduction Windowing systems and window managers alike have date a particular kind of window manager to be assumed crucial roles in guiding the look and feel of running and thereby allows its users to swap out graphical user interfaces. In fact, without them, the the window manager if they see fit, facilitating cus- concept of a graphical user interface would not even tomizability. To make such customizability possible, exist. The windowing system allows for the draw- the X Window System does not define policy, only ing of graphical primitives to the screen, and creates mechanism. To ensure that applications are able to the notion of windows. Windows are presented on work well together and can communicate with the screen, and convey important information from ap- window manager, several standard protocols were plications to the user, but how are they to be ma- designed to define a layer of policy atop of the X nipulated? The windowing system merely provides