How X Window Managers Work, and How to Write One

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • river

    [mirror] A dynamic tiling Wayland compositor (by riverwm)

  • And I see no purpose in switching to Wayland as long as Xorg keeps working just fine.

    > If you liked bspwm then you might want to try this: https://github.com/riverwm/river

    If I wanted to spend time redoing my configuration, maybe, but I have better things to spend my time on. So in however many years it takes before getting Xorg running starts taking more effort than switching. I'm not expecting that to happen anytime soon.

  • tinywm

    The tiniest window manager.

  • This is a great article and I remember reading it numerous times while I was implementing my own window manager.

    For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

    - https://github.com/mackstann/tinywm

    - https://github.com/venam/2bwm

    - https://github.com/dylanaraps/sowm

    - https://github.com/dcat/swm

    - https://github.com/JLErvin/berry

    Which are great at introducing the concepts and allowing you to grok the required libraries.

    There are also a bunch of more full featured window managers which will introduce you to more advanced topics:

    - https://github.com/baskerville/bspwm

    - https://github.com/herbstluftwm/herbstluftwm

    - https://www.nongnu.org/ratpoison/

    - https://github.com/conformal/spectrwm

    Gradually as you get more familiar with the ecosystem a few questions will come up:

    Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

    X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

    Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • 2bwm

    A fast floating WM written over the XCB library and derived from mcwm.

  • This is a great article and I remember reading it numerous times while I was implementing my own window manager.

    For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

    - https://github.com/mackstann/tinywm

    - https://github.com/venam/2bwm

    - https://github.com/dylanaraps/sowm

    - https://github.com/dcat/swm

    - https://github.com/JLErvin/berry

    Which are great at introducing the concepts and allowing you to grok the required libraries.

    There are also a bunch of more full featured window managers which will introduce you to more advanced topics:

    - https://github.com/baskerville/bspwm

    - https://github.com/herbstluftwm/herbstluftwm

    - https://www.nongnu.org/ratpoison/

    - https://github.com/conformal/spectrwm

    Gradually as you get more familiar with the ecosystem a few questions will come up:

    Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

    X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

    Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

  • sowm

    An itsy bitsy floating window manager (220~ sloc!).

  • This is a great article and I remember reading it numerous times while I was implementing my own window manager.

    For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

    - https://github.com/mackstann/tinywm

    - https://github.com/venam/2bwm

    - https://github.com/dylanaraps/sowm

    - https://github.com/dcat/swm

    - https://github.com/JLErvin/berry

    Which are great at introducing the concepts and allowing you to grok the required libraries.

    There are also a bunch of more full featured window managers which will introduce you to more advanced topics:

    - https://github.com/baskerville/bspwm

    - https://github.com/herbstluftwm/herbstluftwm

    - https://www.nongnu.org/ratpoison/

    - https://github.com/conformal/spectrwm

    Gradually as you get more familiar with the ecosystem a few questions will come up:

    Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

    X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

    Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

  • swm

    simple window manager (by dcat)

  • This is a great article and I remember reading it numerous times while I was implementing my own window manager.

    For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

    - https://github.com/mackstann/tinywm

    - https://github.com/venam/2bwm

    - https://github.com/dylanaraps/sowm

    - https://github.com/dcat/swm

    - https://github.com/JLErvin/berry

    Which are great at introducing the concepts and allowing you to grok the required libraries.

    There are also a bunch of more full featured window managers which will introduce you to more advanced topics:

    - https://github.com/baskerville/bspwm

    - https://github.com/herbstluftwm/herbstluftwm

    - https://www.nongnu.org/ratpoison/

    - https://github.com/conformal/spectrwm

    Gradually as you get more familiar with the ecosystem a few questions will come up:

    Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

    X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

    Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

  • berry

    :strawberry: A healthy, byte-sized window manager (by JLErvin)

  • This is a great article and I remember reading it numerous times while I was implementing my own window manager.

    For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

    - https://github.com/mackstann/tinywm

    - https://github.com/venam/2bwm

    - https://github.com/dylanaraps/sowm

    - https://github.com/dcat/swm

    - https://github.com/JLErvin/berry

    Which are great at introducing the concepts and allowing you to grok the required libraries.

    There are also a bunch of more full featured window managers which will introduce you to more advanced topics:

    - https://github.com/baskerville/bspwm

    - https://github.com/herbstluftwm/herbstluftwm

    - https://www.nongnu.org/ratpoison/

    - https://github.com/conformal/spectrwm

    Gradually as you get more familiar with the ecosystem a few questions will come up:

    Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

    X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

    Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

  • bspwm

    A tiling window manager based on binary space partitioning

  • This is a great article and I remember reading it numerous times while I was implementing my own window manager.

    For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

    - https://github.com/mackstann/tinywm

    - https://github.com/venam/2bwm

    - https://github.com/dylanaraps/sowm

    - https://github.com/dcat/swm

    - https://github.com/JLErvin/berry

    Which are great at introducing the concepts and allowing you to grok the required libraries.

    There are also a bunch of more full featured window managers which will introduce you to more advanced topics:

    - https://github.com/baskerville/bspwm

    - https://github.com/herbstluftwm/herbstluftwm

    - https://www.nongnu.org/ratpoison/

    - https://github.com/conformal/spectrwm

    Gradually as you get more familiar with the ecosystem a few questions will come up:

    Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

    X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

    Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • herbstluftwm

    A manual tiling window manager for X11

  • This is a great article and I remember reading it numerous times while I was implementing my own window manager.

    For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

    - https://github.com/mackstann/tinywm

    - https://github.com/venam/2bwm

    - https://github.com/dylanaraps/sowm

    - https://github.com/dcat/swm

    - https://github.com/JLErvin/berry

    Which are great at introducing the concepts and allowing you to grok the required libraries.

    There are also a bunch of more full featured window managers which will introduce you to more advanced topics:

    - https://github.com/baskerville/bspwm

    - https://github.com/herbstluftwm/herbstluftwm

    - https://www.nongnu.org/ratpoison/

    - https://github.com/conformal/spectrwm

    Gradually as you get more familiar with the ecosystem a few questions will come up:

    Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

    X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

    Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

  • spectrwm

    A small dynamic tiling window manager for X11.

  • This is a great article and I remember reading it numerous times while I was implementing my own window manager.

    For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

    - https://github.com/mackstann/tinywm

    - https://github.com/venam/2bwm

    - https://github.com/dylanaraps/sowm

    - https://github.com/dcat/swm

    - https://github.com/JLErvin/berry

    Which are great at introducing the concepts and allowing you to grok the required libraries.

    There are also a bunch of more full featured window managers which will introduce you to more advanced topics:

    - https://github.com/baskerville/bspwm

    - https://github.com/herbstluftwm/herbstluftwm

    - https://www.nongnu.org/ratpoison/

    - https://github.com/conformal/spectrwm

    Gradually as you get more familiar with the ecosystem a few questions will come up:

    Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

    X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

    Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

  • natwm

    Not A Tiling Window Manager

  • This is a great article and I remember reading it numerous times while I was implementing my own window manager.

    For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

    - https://github.com/mackstann/tinywm

    - https://github.com/venam/2bwm

    - https://github.com/dylanaraps/sowm

    - https://github.com/dcat/swm

    - https://github.com/JLErvin/berry

    Which are great at introducing the concepts and allowing you to grok the required libraries.

    There are also a bunch of more full featured window managers which will introduce you to more advanced topics:

    - https://github.com/baskerville/bspwm

    - https://github.com/herbstluftwm/herbstluftwm

    - https://www.nongnu.org/ratpoison/

    - https://github.com/conformal/spectrwm

    Gradually as you get more familiar with the ecosystem a few questions will come up:

    Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

    X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

    Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

  • hello-wayland

    A hello world Wayland client (mirror)

  • You think this is bad? Just look at a native Wayland "Hello World" client [1]. This doesn't even print hello world. You have to do the text rendering yourself. And you need at least 500 more lines to implement the equivalent to a simple XGetImage() call.

    1.: https://github.com/emersion/hello-wayland/blob/master/main.c

  • dwl

    Discontinued dwm for Wayland - ARCHIVE: development has moved to Codeberg

  • mir

    The Mir compositor (by canonical)

  • People have already mentioned wlroots as a starting point, but there is a less opinionated and more compatible (NVIDIA-ready) library that I’m really quite fond of called Mir: https://github.com/MirServer/mir

    One thing to note, Wayland, unlike X, does not support server side decorations yet, so compositor’s responsibilities are mostly just placing windows.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts