Skip to content

Extremely basic X11 compositing window manager written in C with Xlib and OpenGL.

License

Notifications You must be signed in to change notification settings

obiwac/x-compositing-wm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

x-compositing-wm

Extremely basic X11 compositing window manager written in C with Xlib and OpenGL.

alt text

Disclaimer

This is very much not intended for use, but merely as a tool to (hopefully) help understand how to write an X11 compositing window manager better than what the quite frankly pisspoor documentation provides. As such, many best practices are not employed, and a lot of features you'd want to implement aren't implemented (list near the end of this document). It's also worth noting that I'm in no way shape or form an expert on X, this was just a weekend project that works by miracle.

This was also originally meant as a prototype to AQUA's wm.* devices, so some coding decisions and comments may seem a bit strange.

I may or may not end up updating this with new features, but I welcome any pull requests you might have!

Compiling and installing

On Linux or *BSD or whatever, compile with:

$ cc src/main.c -Isrc -I/usr/local/include -L/usr/local/lib -lX11 -lGL -lGLEW -lXcomposite -lXfixes -lXinerama -lm -o x-compositing-wm

This creates an x-compositing-wm executable which you can put anywhere really (like /usr/local/bin/ or ~/.local/bin/ or whatever). You can then set this to run automatically when you run startx by adding something like this to the end of your ~/.xinitrc:

exec x-compositing-wm

Features

  • Basic window interaction.
  • Basic graphical effects (shadows, rounded corners).
  • Basic.
  • Basic animations (smoothing when moving/resizing windows, animations when creating windows, &c).
  • Basic EWMH compliance (so it can work with programs like OBS).

Default keybindings

  • Super+Left click and drag: Move window.
  • Super+Right click and drag: Resize window.
  • Super+F1: Quit WM.
  • Super+F: Make window fullscreen.
  • Super+Alt+F: Make window fullfullscreen.
  • Super+V: Enable or disable vsync (GIMP doesn't work with vsync for reasons I haven't had time to investigate).
  • Super+R: Restart WM.
  • Super+T: Open xterm instance.

List of things you'll want to add in your own compositing WM

  • More error handling.
  • A fallback for when modern OpenGL (3.3) is not available.
  • Probably use XDamage to not needlessly update regions of the screen that don't need updating, although TBH I'm not sure if these days it's really a big deal.
  • Freeing allocated memory correctly.
  • Capturing focus events so clients can ask for focus (necessary for dropdowns to work properly, which are their own separate windows most of the time).
  • Apparently it's better performance-wise to use XCB instead of Xlib these days. You may wanna look into that.
  • Make resizing windows not dumb.

About

Extremely basic X11 compositing window manager written in C with Xlib and OpenGL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages