I have a xlib window manager and I create Windows using XCreateSimpleWindow. The function allowed selecting an initial window background color. I want to change this color at runtime. I found this is possible with XSetWindowBackground. However, to see the changes, I need to unmap and map the window. In my program I will not be able to constantly do this. Additionally, this does not seem like great programming either.

Is there a better way to change the window background color?

1 Answer 1


man XSetWindowBackground:

To repaint the window and its background, use XClearWindow
  • Dang, I tried this before but accidently put in the wrong window. Thanks!
    – Eshy
    Nov 24, 2022 at 15:20
  • You're welcome, @Eshy. When will you present us with your window manager?
    – Quasímodo
    Nov 24, 2022 at 18:54
  • Hopefully soon! It's coming along wayy better than I expected given what I read. It's already functional and fairly configurable. Needs a lot of quality of life improvements, which I am working on now. Thanks for showing interest!
    – Eshy
    Nov 24, 2022 at 22:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .