Skip to content
An example basic X11 window manager.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Makefile. Feb 1, 2017
.ycm_extra_conf.py Lint Feb 1, 2017
Makefile
README.md Update README Feb 13, 2017
SConstruct Clang build environment. May 6, 2014
basic_wm_screenshot.png Include screenshot image and use relative link in README. Mar 25, 2014
build_and_run.sh Add check for override_redirect flag Feb 2, 2017
main.cpp Lint Feb 1, 2017
util.cpp Handle out-of-range XEvent types gracefully. Feb 14, 2017
util.hpp Lint Feb 1, 2017
window_manager.cpp Improve comments Feb 3, 2017
window_manager.hpp Do not frame invisible or override_redirect windows on start up Feb 2, 2017
xinitrc Lint Nov 9, 2013

README.md

Basic Window Manager

basic_wm is a simple reparenting, non-compositing X window manager that demonstrates how to implement the fundamental functionality of a window manager:

  • Managing the life cycle of windows
  • Reparenting windows
  • Basic window operations (moving, resizing, closing)

It serves as a pedagogical example for my series of articles, How X Window Managers Work, And How To Write One.

Building and Running

To build this example window manager, you will need:

To run and test it, you will need:

  • Xephyr
  • xinit
  • Random X utilities such as xclock, xeyes, and xterm to play with

On Ubuntu/Debian, you can install these dependencies with:

sudo apt-get install \
    build-essential libx11-dev libgoogle-glog-dev \
    xserver-xephyr xinit x11-apps xterm

On Fedora/CentOS, you can install these with:

sudo yum install \
    make gcc gcc-c++ libX11-devel glog-devel \
    xorg-x11-server-Xephyr xorg-x11-apps xterm

On Arch Linux, you can install these with:

yaourt -S base-devel libx11 google-glog \
    xorg-server-xephyr xorg-xinit xorg-xclock xorg-xeyes xterm

Consult your own distro's documentation for how to install these.

Once you have all the dependencies, building and running it is as simple as:

./build_and_run.sh

This will launch a simple Xephyr session like in the following screenshot: Screenshot

Usage

Supported keyboard shortcuts:

  • Alt + Left Click: Move window
  • Alt + Right Click: Resize window
  • Alt + F4: Close window
  • Alt + Tab: Switch window
You can’t perform that action at this time.