You are not logged in.

#1 2011-07-04 22:16:44

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

So I want to write a window manager in Python. Where to start?

The problem: I know how to use a few programming languages now, but my ability to actually design software is quite weak. Also, I'm somewhat unhappy with the current assortment of window managers.

I figured a (relatively) simple window manager, written in Python using Python-xlib or even Tkinter, would be a good project for learning how to better design a program.

Unfortunately, I'm running into some problems. I've looked at the source codes of a few WMs, but they tend to be huge and difficult to understand, or just difficult to understand. (Yes, even DWM's source code.) I did take a look at TinyWM, and I think I "get it"; but in general I'm having a tough time figuring out what I need to do.

So... What resources do you guys think would be helpful? Any program sources I should look at? Any helpful documentation that's still readable for those who don't understand C inside and out? Any other advice?

Offline

#2 2011-07-04 22:33:02

Nisstyre56
Member
From: Canada
Registered: 2010-03-25
Posts: 85

Re: So I want to write a window manager in Python. Where to start?

http://python-xlib.sourceforge.net/?page=home
http://www.archlinux.org/packages/commu … thon-xlib/

Those would both be a great place to start imo. Writing a window manager is a rather complex task, and I think there's a lot of different approachs you could take. Maybe just trying to get basic windows working with the ability to resize and layer them would be a good first task? You could write a basic class for encapsulating one window, and then abstract it into a general "layering" class that keeps track of where every window is.

Last edited by Nisstyre56 (2011-07-04 22:40:55)


In Zen they say: If something is boring after two minutes, try it for four. If still boring, try it for eight, sixteen, thirty-two, and so on. Eventually one discovers that it's not boring at all but very interesting.
~ John Cage

Offline

#3 2011-07-04 22:49:18

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: So I want to write a window manager in Python. Where to start?

How about qtile

Scott

Offline

#4 2011-07-05 06:12:55

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: So I want to write a window manager in Python. Where to start?

firecat53 wrote:

How about qtile

Scott

I concur, qtile is a fully-featured window manager, written in python, perfect
for your needs. It's still young, so as soon as you understood and configured
it, you can start contributing code. Its creator is very nice, understanding and
open for suggestions and contributions.

Hope seeing you on the mailing list!

Offline

#5 2011-07-07 21:49:36

diegoviola
Member
Registered: 2010-12-16
Posts: 134

Re: So I want to write a window manager in Python. Where to start?

Deleted.

Last edited by diegoviola (2023-04-17 22:33:01)

Offline

#6 2011-07-07 23:34:58

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: So I want to write a window manager in Python. Where to start?

Re qtile: thanks for the pointer. It looks interesting... However, I was under the impression that the best way to learn how to program was to write your own application(s) from scratch?

Re Wayland: it's still going to be some time before it's usable for anything, no?

(Also, I have to ask: will Wayland eventually be able to run without 3D acceleration? Will it ever support dodgy video cards on older computers, e.g. S3 Savage and Via Unichrome? Will it actually provide performance and stability benefits over X11 - e.g. being able to recover from crashes without losing applications - or will it just be a less kludgy way to get eyecandy on Linux? Because if at least the first of those isn't on the menu, I think it's a nonstarter.)

Offline

#7 2011-07-08 00:10:46

diegoviola
Member
Registered: 2010-12-16
Posts: 134

Re: So I want to write a window manager in Python. Where to start?

Deleted.

Last edited by diegoviola (2023-04-17 22:32:55)

Offline

#8 2011-07-08 06:30:30

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: So I want to write a window manager in Python. Where to start?

Gullible Jones wrote:

Re qtile: thanks for the pointer. It looks interesting... However, I was under the impression that the best way to learn how to program was to write your own application(s) from scratch?

In my humble opinion, looking at experienced people's code (especially if you
can ask them about design decisions) makes you realize how code actually gets
written and how projects evolve. You learn coding by actually coding, but that
doesn't mean you should reinvent the wheel (specifically not if it's a wheel as
big as a full-featured WM).

I think you should try out qtile. You'll need to learn some python even to get
your configuration working (as that is written in python, too). While using the
WM, you might eventually trip over things not working (e.g. currently the prompt
widget lacks unicode support) or things that don't work the way you like it
(e.g. the design of the tiling algorithms is currently under discussion on the
mailing list). Then, you can start changing code, contributing and discussing
and I'm sure this will get you a long way of learning how to code.

Kind regards

Offline

Board footer

Powered by FluxBB