Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I decided to write my own DE using these instructions here it worked and I can login however I didn't use a panel so I don't have a logout button or a session manager.

I've decided to write my own session manager (instead of using established ones) so I can quit the session and return to the lightdm login screen. I've been reading and get the basic idea of what a session manager is but I don't understand how to actually log out and shutdown.

So how does that option work with a custom session manager? If that's too broad, how—after starting a session with a python script—do I return control to lightdm after shutting down all of my desktop applications, file manager, etc?

And for shutdown how do I properly shutdown a graphical desktop.

share|improve this question
add comment

1 Answer

The display manager passes control to your desktop session by running a program. All you have to do to return control is have your desktop session terminate by calling exit.

For example, on my Fedora system, the display manager runs /etc/X11/xinit/Xsession, which starts the desktop session manager.

For shutdown? Terminate all the processes you started (and their descendants), then use your operating system's shutdown procedure, e.g. run init 0, /sbin/shutdown, or similar.

share|improve this answer
1  
The X server just runs one program, then exits (or restarts, in modern times). If you're running a DM, it'll exec(2) a shell to run a script, which then becomes the session controller. Traditionally, the session script started clients in the background, then ran the WM in the foreground so it would become the session controller. This is done behind the scenes by modern desktop environments with their own session management. –  Alexios Jun 26 '12 at 8:06
    
On modern systems, shutdown involves D-Bus. This allows non-root users to trigger a shutdown. –  Gilles Jun 26 '12 at 21:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.