Question

I want to make a window manager in either of these languages (Preferably ruby). I honestly have no idea where to start except that I will need some kind of X module to load. So if anyone has a clue it would be great if you could point me in the right direction. Thanks

Was it helpful?

Solution

XCB, the next gen API for X uses an XML format to define X protocols and generates specific language bindings with a script. It's similar in concept to SWIG except that instead of describing C APIs, it describes X protocols.

Currently, bindings exist for C and Python. A Ruby port would theoretically be only a matter of writing a translator from the XML protocol definition language to Ruby. The generated Ruby code could either wrap the C API or implement the wire protocol in pure Ruby (I recommend the latter).

The API apparently has some inherent advantages over the legacy Xlib related to blocking I/O. It also has a Windows port, oddly enough.

http://xcb.freedesktop.org/

http://xcb.freedesktop.org//XcbPythonBinding/

http://xcb.freedesktop.org//win32port/

OTHER TIPS

Have you looked at http://ruby-xlib-wrap.sourceforge.net/. This appears to provide Ruby bindings for XLib.

You may want to experiment with using XWindows before trying to write a window manager.

Why not start with a desktop, so you can get some experience.

Note:

1) Awesome is not written in lua, it's written in C. It uses Lua as a scripting/config interface.

2) Qtile and Samurai-X are two wm's are written in python.

3) Subtle is a wm that uses ruby as a scripting language.

Qtile and Subtle are both tiling window managers.

Not Ruby or Python, but these window managers are also written in cool languages: awesome (Lua) and XMonad (Haskell). Maybe you can peek inside their internals and see how they work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top