ArticleslgStudy

computer science

Xmonad

Xmonad is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Xmonad rather than just read about it. In short: xmonad is a dynamic window manager (tiling) for the X Window System, noted for being written in the functional programming language Haskell. Window manager Begun in March 2007, version 0.1 was announced in April 2007 as 500 lines of Haskell (which have since grown to 2000 lines). xmonad is a tiling window manager, akin to dwm, larswm, and StumpWM.

Xmonad — main illustration
Xmonad — illustration

Key takeaways

  • Xmonad belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Xmonad to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Xmonad from memory before moving on to harder problems.

Reference excerpt

xmonad is a dynamic window manager (tiling) for the X Window System, noted for being written in the functional programming language Haskell.

Window manager Begun in March 2007, version 0.1 was announced in April 2007 as 500 lines of Haskell (which have since grown to 2000 lines). xmonad is a tiling window manager, akin to dwm, larswm, and StumpWM. It arranges windows in a non-overlapping pattern, and enables managing windows without using a mouse. xmonad is packaged and distributed on a wide range of Unix-like operating systems, including many Linux distributions, and Berkeley Software Distribution (BSD) systems. While originally a clone of dwm (derivative in areas such as default keybindings), xmonad now supports features unavailable to dwm users such as per-workspace layout, tiling reflection, state preservation, layout mirroring, GNOME support and per-screen status bars; it can be customised by modifying an external configuration file and 'reloaded' while running. xmonad features have begun to influence other tiling window managers: dwm has borrowed "urgency hooks" from xmonad, has also included Xinerama support (for multihead displays) with release 4.8, and patches exist to reimplement xmonad's Fibonacci spiral layout.

Haskell project

In 2023 the man page stated: By utilising the expressivity of a modern functional language with a rich static type system, xmonad provides a complete, featureful window manager [...], with an emphasis on correctness and robustness. Internal properties of the window manager are checked using a combination of static guarantees provided by the type system, and type-based automated testing. A benefit of this is that the code is simple to understand, and easy to modify. Since xmonad's inception, when its small source code size of 500 lines of code was advertised, it has grown to about 2,000 lines as of 2023. Extensions to the core system, including emulation of other window managers, and unusual layout algorithms, such as window tiling based on the Fibonacci spiral—have been implemented by the active community and are available as a library. Along with obviating the need for a mouse, the xmonad developers make heavy use of semi-formal methods and program derivation for improving reliability and enabling a total line of code count less than 1200, as of version 0.7; window manager properties (such as the behavior of window focus) are checked through use of QuickCheck. This emphasis makes xmonad unusual in a number of ways; besides being the first window manager written in Haskell, it is also the first to use the zipper data structure for automatically managing focus, and its core has been proven to be safe with respect to pattern matches, contributing further to reliability. The developers write:

xmonad is a tiling window manager for the X Window system, implemented, configured and dynamically extensible in Haskell. This demonstration presents the case that software dominated by side effects can be developed with the precision and efficiency we expect from Haskell by utilising purely functional data structures, an expressive type system, extended static checking and property-based testing. In addition, we describe the use of Haskell as an application configuration and extension language. The code is separated into side-effect free code, and a thin wrapper for the side-effects. According to Alejandro Serrano Mena, there are two ways to implement domain-specific languages for actions in Haskell applications and libraries: "developing a combinator library" or "rolling your own monad", with xmonad being a successful example of the latter. xmonad was regarded as one of the most well known Haskell projects in a 2013 functional programming book.

Reception Linux Magazine included xmonad in a list of "My Top Resources of 2009". In 2012, How-To Geek described xmonad as having good, but complex, ability to be configured, and it was included in a 2013 list of eight desktop environments for Linux. Lifehacker wrote that the basic operations of xmonad's user interface can be taught using a small set of instructions. A high level of customisation and speed were noted by Network World, and in MakeUseOf xmonad was reviewed positively compared to Openbox. In 2016 Ars Technica said xmonad and Awesome had more advanced tiling ability than Cinnamon. In 2017 it was described as powerful, with application as a window manager for big data, while in an article on opensource.com on the other hand, dwm was chosen over xmonad. A TechRadar review of the "Best Linux desktop of 2018" said "If there's one desktop environment that stands out from all the others we have here, it's this one." Due to the small number of source lines of code of the Xmonad application, the use of the purely functional programming language Haskell, and recorded use of a rigorous software testing procedure, it is sometimes used as a baseline application in other research projects. This has included re-implementing xmonad using the Rocq proof assistant, a determination xmonad is an imperative program, and studies of package management relating to a Linux distribution NixOS that is based on the package manager Nix.

See also

Comparison of X window managers Formal verification

References

Works cited

Further reading Lunduke, Bryan (2018-02-05). Half a Decade of Linux-y Shenanigans. Bryan Lunduke. p. 5. ISBN 9781387571246. According to Bryan Lunduke xmonad is an unknown desktop environment written in an unknown programming language, adding "Are xmonad and Haskell failures? Are they dead? No. Because they are unique. They are customizable. They are alive and kicking (and awesome)." Tucker, Ronnie (29 November 2013). "Full Circle Magazine #79: The Independent Magazine for the Ubuntu Linux Community". Full Circle. Full Circle Team – via Google Books. – the use of xmonad and other lightweight window managers

External links

Official website "Taste of Haskell" – O'Reilly Open Source Convention (OSCON) presentation by Simon Peyton Jones on Haskell, using xmonad as an example First half of talk on YouTube (video) Second half of talk on YouTube (video)

Illustrations

Xmonad illustration
Xmonad illustration
Xmonad: xmonad's Xinerama support: tiling on three screens simultaneously.
xmonad's Xinerama support: tiling on three screens simultaneously.
Xmonad: xmonad in tiling mode
xmonad in tiling mode

Worked examples

Example 1 — a first encounter with Xmonad

Start with the simplest possible case. Write down what Xmonad claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Xmonad before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Xmonad ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Xmonad

In research
Xmonad appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Xmonad in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Xmonad is common in secondary-school and first-year university syllabi. It links to neighbouring topics Free X window managers, Free software programmed in Haskell, Software using the BSD license, so understanding it makes those chapters shorter.
In everyday life
Look for Xmonad outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Xmonad” →

How to study Xmonad in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Xmonad means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Xmonad out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Xmonad in simple terms?

xmonad is a dynamic window manager (tiling) for the X Window System, noted for being written in the functional programming language Haskell. Window manager Begun in March 2007, version 0.1 was announced in April 2007 as 500 lines of Haskell (which have since grown to 2000 lines). xmonad is a tiling…

Why does Xmonad matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Xmonad?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Xmonad.

Tags

  • Free X window managers
  • Free software programmed in Haskell
  • Software using the BSD license
  • Tiling window managers
  • X window managers extensible by scripting

Keep exploring