CWM Patches

A collection of patches for the CWM window manager from OpenBSD. These patches are also applicable to Christian Neukirchen's portable CWM. A development branch that includes all these patches is available on Github.


Fix moving of clients to group 0


Some clients (e.g., stalonetray) are shy and may hide at start-up if configured with autogroup 0. This patch fixes this issue. (Fixed in OpenBSD 6.1)

Fix screen_area(), remove unused fields from region_ctx


In screen_area(), if no matching region is found, the gap will effectively be applied one time too many. Additionally, is never used, and .area is the same as .view, so I removed these (except .view).

If cwm-keep-visible.patch is applied, this patch cannot be applied and is not needed.

Smaller patches

cwm-ignored-borders.patch: Don't put border on ignored clients when returning from fullscreen. (In OpenBSD 6.1)

cwm-resize-new.patch: Resize new clients after client_placecalc(). This is needed if client_placecalc() decides to change size of the new window. (In OpenBSD 6.1)

cwm-ptrwarp-inbound.patch: Ensure pointer is within warped-to window. This is relevant after a window shrinks (e.g., is unmaximized) and another client becomes active. (Fixed in OpenBSD 6.1)


Preserve stacking order during cycling

cwm-restack.patch v3

After cycling through many windows, the original window may be obscured by many others, and if you still want to see its contents you end up doing the Alt-Tab-Tab-Tab-Tab-Tab, Alt-Tab, Alt-Tab dance.

This patch adds restacking of windows during cycling. Hold Alt, press Tab and a window will be raised. Press Tab again while still holding Alt and that window will be lowered back before another is raised. Once you release Alt, the original window will be hidden behind no more than one other (the target), assuming it was raised before.

Always keep clients visible

cwm-keep-visible.patch v3

cwm makes a client active only when the mouse pointer enters the window. Thus, once a client is off screen and another becomes active, it's lost forever.

This patch forces clients to overlap with at least one region (known as "CRTC" (or "output"?) to XRandR fans and "monitor" to normal people) when the client is moved or resized (or does it to itself). The client's region is:

When XRandR configuration changes, for every old region a matching new region is calculated using the algorithm above, and all clients within it migrate to the new region while preserving their relative positions. Full screen and maximized clients may change their sizes accordingly. Tiled regions may become no longer properly tiled.


Limitations: XSHAPE is not handled.

Don't clear urgency flag while cycling

cwm-cycling-urdency.patch v2

Don't clear the orange border signifying urgency (_NET_WM_STATE_DEMANDS_ATTENTION) from windows when Alt-Tabbing through them. Instead, do it when Alt is released within such window, or when the mouse is moved into it.

Code simplifications

cwm-simplify-ghoh.patch: Simplify group_holds_only_hidden(). (In OpenBSD 6.1)

cwm-simplify-toggles.patch: Simplify client_toggle_*(). (In OpenBSD 6.1)

cwm-minsize.patch: Remove redundant minimum client size adjustment. (In OpenBSD 6.1)

Valid XHTML 1.0! Valid CSS!
Vadik /
Last updated: 2017-02-18