0.1.2 • Published 9 years ago

basedwm v0.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
9 years ago

basedwm npm.io

Minimalistic X window manager in LiveScript, with an infinite panning desktop. Controlled by named pipe. Emits focus events and window positions on a socket.

Install

You only need Node.js (or io.js) to run the basic WM.

  sudo npm i -g basedwm

Then add 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.

Keyboard controls

Recommendations

To bind commands to keyboard controls, I recommend sxhkd. A suitable example config is in example/basedwm.sxhkdrc.

Details

Basedwm is controlled through a named pipe, by default at /tmp/basedwm:0-cmd.fifo (where the :0 is the contents of the $DISPLAY env variable). The program basedc is provided for convenience; it just echoes its arguments into that pipe.

Some commands are stateless and run immediately:

namedescription
exitterminates the program
raiseraises the currently focused window
pointer-raiseraises window under pointer
move x ymoves the currently focused window by the given amount
move-all x ymoves all windows, effectively panning the desktop
resize x yresizes the currently focused window by the given amount
destroycloses the currently focused window (polite suggestion)
killkills the currently focused window (force close)

So basedc move-all 50 -50 to move all windows 50px right and 50px up.

The stateful ones are intended for pointer interaction:

namedescription
pointer-move x ymoves focused window with pointer
pointer-resize x yresizes focused window with the pointer
pointer-move-all x ypans desktop with pointer
resetresets 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.

Window decorations

Recommendations

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 net.connects 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.

Details

Basedwm outputs window positions on a socket in /tmp/wmstate.sock, as newline-delimited JSON objects. Every object has a property id with the window's ID, and a property action representing the event type.

The possible actions and their additional properties are:

actiondescriptionadditional properties
focuswindow gained focusnone
destroywindow was destroyednone
existing-addinitial window positionx, y, width, height
addwindow was addedx, y, width, height
movewindow was movedx, y
resizewindow was resizedwidth, height

existing-add-events are only sent immediately after connecting. This lets any consuming program initialise its copy of the window positions.

The x and y properties indicate the absolute coordinates of the window's top-left corner, relative to the screen's top-left corner. The width and height properties indicate the absolute dimensions of the window.

You can easily survey the output using socat UNIX:/tmp/wmstate.sock -.

Bugs

Yes.

Inspirations & thankyous

Intended as a modern reinterpretation of swm, with the big virtual desktop taken to the extreme. Exposing controls on a pipe/socket interface and outsourcing controls to sxhkd are ideas from bspwm.

License

ISC.