sudo npm i -g basedwm
exec basedwm to your
~/.xinitrc, commenting out any existing WM.
However, note that basedwm alone doesn't provide any keyboard or pointer controls or window decorations. Instead, it takes control input from a named pipe and logs focus events and window positions out to another named pipe. This way you can easily switch out what programs you use to control it or to render window decorations.
Basedwm is controlled through a named pipe, by default at
/tmp/basedwm:0-cmd.fifo (where the
:0 is the contents of the
env variable). The program
basedc is provided for convenience; it just
echoes its arguments into that pipe.
Some commands are stateless and run immediately:
|exit||terminates the program|
|raise||raises the currently focused window|
|pointer-raise||raises window under pointer|
|move x y||moves the currently focused window by the given amount|
|move-all x y||moves all windows, effectively panning the desktop|
|resize x y||resizes the currently focused window by the given amount|
|destroy||closes the currently focused window (polite suggestion)|
|kill||kills the currently focused window (force close)|
basedc move-all 50 -50 to move all windows 50px right and 50px up.
The stateful ones are intended for pointer interaction:
|pointer-move x y||moves focused window with pointer|
|pointer-resize x y||resizes focused window with the pointer|
|pointer-move-all x y||pans desktop with pointer|
|reset||resets pointer drag state|
Remember to send a
reset once each drag is done! This tells basedwm that the
next pointer command will be a separate action.
Hudkit was written for this. I'll get around to uploading my setup
eventually, but the basic idea is to create a Node server that
to the WM state socket, dumps the events into a websocket and serves up a page
that uses D3 to render borders and a minimap. Screenshot here.
Basedwm outputs window positions on a socket in
newline-delimited JSON objects. Every object has a property
the window's ID, and a property
action representing the event type.
actions and their additional properties are:
|focus||window gained focus||none|
|destroy||window was destroyed||none|
|existing-add||initial window position||
|add||window was added||
|move||window was moved||
|resize||window was resized||
existing-add-events are only sent immediately after connecting. This lets
any consuming program initialise its copy of the window positions.
y properties indicate the absolute coordinates of the window's
top-left corner, relative to the screen's top-left corner. The
height properties indicate the absolute dimensions of the window.
You can easily survey the output using
socat UNIX:/tmp/wmstate.sock -.
Inspirations & thankyous