Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m looking into delving into a bit of custom OS work (and yes I understand tha

ID: 654227 • Letter: I

Question

I'm looking into delving into a bit of custom OS work (and yes I understand that doing any development at the DE level or lower on an OS is extremely complex and not a light thing to undertake, curiosity is driving this though), I'm in the research phase right now, digging around and learning by example from the source code for projects like GNOME, KDE and XFCE.

I can't seem to find a really good resource, or resources that describes how a "desktop environment" is initialized, instantiated and drawn to the screen of the user (i.e. it's lifecycle). I know that Xorg/X11 sits in there somewhere, acting as server and the users screen is the client, and your desktop sits on top of this client. A lot of resources just start talking about rearranging combinations of already developed window managers, apps and such in order to customize your desktop experience, but what I'm thinking is what If I wanted a stripped down OS that only consisted of a screen with three buttons that performed some actions and that was it? I don't need window management, applications, or other GUI items, just the ability to draw a desktop and three buttons... (hypothetical)

My problem is at the distro level, how does a DE get registered as an available desktop environment, how is it strapped into the distros boot up, what happens after the login, what's run, what is the topography of a DE? By example, in Ubuntu you can have KDE, XFCE and GNOME installed on one distro and switch between them by logging out, changing the active DE and logging back in so how does the DE make the OS aware of its existence in the first place?

I only really need high level here really, I want to do something fairly simple in that I want to make a DE available in a distro like Ubuntu Desktop (not openly, I mean just for myself) and initialize to an empty desktop (no taskbar, apps, window manager, etc...; just the most base state possible) in order to understand what's required to get a DE running.

I don't need code specific answers (where's the challenge in that right?) but pointers to good resources on how this process works. I'll take a well formed textual answer over a chunk of code as I'm looking to understand how it all works, the path taken to get to a DE and not implementation specifics.

The outcome of this will not technically be published (code-wise) but I'm looking at doing some blog posts that describe the process of learning all of this and writing the DE layer in order to get a "Raw" desktop up and running in a pre-existing/established OS like Ubuntu, Mint, Gentoo or another distro.

Explanation / Answer

Well, I never actually did what you want to do, but I have some ideas you may consider.

If I were to try what you are doing I would look for a very basic, ultra-minimalistic DE, so that there is little noise and maybe I can build on it.

About how things are starting up. Well, you explained it in big. I would add the following details, general stuff - not Ubuntu specific.

On my Linux, I use Sabayon, but probably on other distros too, there should be a service responsible to initializing X.org and maybe offering the graphical login screen. Look for things like /etc/init.d/xdm , or kdm, gdm, etc. Where "dm" is usually stands for "Display Manager".

After login, "/etc/X11/xinit/xinitrc" is involved in the action. I'm not sure why. In this, or in the user's "~/.xinitrc" a line will specify the DE you want to use. Here are some examples from my .xinitrc file:

#exec /usr/bin/enlightenment_start
exec /usr/bin/startkde
The first line would start E17 DE, de second one, currently active, starts KDE.

Additionally, as @sepp2k pointed out, "X has the concept of a root window that you can draw to like to any other X11 window. This window exists automatically and doesn't have to be created (the X11 API (as well as higher-level APIs like GDK) has a method to get a reference to the root window). That's how you can draw stuff on the desktop."

Finally, X.org provides a "handle to the DisplayContext" and you can add a "window on top of the display and draws some lines to it." as @jduren discovered later.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote