Creating a window manager

One of my new home projects will be a simple Window Manager, but I need to know some things before starting:

  • What is the best language for this?
  • Where to get some resources to study?
+41
linux x11 window-managers
Nov 28 '09 at 2:11
source share
5 answers

One important decision is how you are going to talk to the X server. You can use Xlib bindings for your language of choice, or you can use a higher level of XCB bindings. (If you're insane , you can directly open the socket for the X server.)

To know how the window manager should work, there are two documents that define conventions and policies: EWMH and ICCCM 1 . Accordingly, your window manager will behave well in GNOME, KDE, XFCE, and any other desktop environment, although simply ignoring them on the first try is certainly easier.

Window Manager does not have to be a huge, complex ball of C. Successful window managers have been written in high-level languages ​​such as Lisp, Haskell, and Python, and even some of C have remained small and readable. XMonad , written in Haskell, has remained under 1000 lines for quite some time. StumpWM (generic Lisp) and DWM (C) are both minimal. You may be able to read their source code to get inspiration on how to create WM files.




1 Ilya Newren wrote:

DO NOT GO AND READ THESE THINGS. THEY ARE REALLY, REALLY BORIS. If you do this, you will probably end up catching up with your dream instead of hacking into Metacity .; -)

Think about it, Metacity in the documentation has something to say about how it interacts with windows and what advanced properties it supports.

+59
Nov 28 '09 at 2:35
source share

tinywm in C may be helpful to get started.

+25
Nov 28 '09 at 2:24
source share

While a different language and a set of libraries are technically possible, I believe that the best choice for the language would be C, as well as the Xlib or XCB libraries. Most window managers for X use this, and there is already a lot of momentum and maturity for these specific libraries.

Some documents of interest:

  • Xlib manual - must read for low-level programming.
  • ICCCM - conventions and interfaces for communication between X applications and the window manager.
  • XCB is a 21st century replacement for Xlib. This is a little lower level and makes less decisions for you than Xlib. From what I collect, the result potentially works better because of the greater potential for asynchrony, but I must warn you that I have never worked with it.
+11
Nov 28 '09 at 2:18
source share
  • What is the best language for this?

    What do you like best. There are many examples of successful window managers in different languages. Qtile and xmonad are good examples written in Python and Haskell respectively.

  • Where to get some resources to study?

    I would look at some existing window managers. There are many of them, so at least some of them must have readable code. Here is the complete list of window managers for Unix .

+7
Nov 28 '09 at 2:23
source share

I know this topic is a bit outdated, but I was interested in the same thing. This window manager called i3 seems good to learn too.

+7
Aug 11 '12 at 19:12
source share



All Articles