/usr/share/xsessions

The list is populated by looking at the contents of the /usr/share/xsessions directory. In here you’ll find files with the .desktop extension (extension hidden in some file managers). As these files are in a system folder, you will need root privileges to change or delete them.

These .desktop files contain basic information on what this menu item will launch. Removing (or renaming) one of these files will take it off the Sessions list.

Modifying an Item

As noted above, you’ll need root privileges to modify any of the files in /usr/share/xsessions. Ubuntu users, for exaple, can hit Alt+F2 to open the command box and enter to run the gedit text editor as root. Open any .desktop file in the /usr/share/xsessions directory that you wish to edit.

Creating a New Entry

Using the above screenshot as a template, you can design your own entry for the menu.
The Encoding line is referring to the character encoding used in the file, and can safely be left at UTF-8 for nearly all purposes.
The Name is what will be displayed on GDM’s Sessions list, followed by a brief description in the Comment line.
The Exec line is probably the most important in the list. This is the section where you specify the command to run when the menu item is clicked. It will accept command line arguments as well (ie gnome-session -f). This line can also be set to a custom script that you have made.
Next is the Icon line, which in some circumstances can be used to specify the icon for an application, but it is not mandatory for the launchers in the session list.
Since .desktop files have uses beyond just GDM, they include a Type field to specify what the file represents. It can be left at Application for these purposes.

A complete list of the properties and their meanings can be found here.
Once your files is saved, you’ll now see it listed on the Sessions list when GDM starts up. You also have the option of setting it as the default desktop session. To do from within Gnome, click System -> Administration -> Login Screen. In the dropdown box, select your new custom entry.

Conclusion

With knowledge of how to control the GDM session options, you’re now in a place where you can create your own custom desktop environment by piecing together the individual components you like. As it so happens, that is the subject of an upcoming article – “How to Create Your Own Custom Desktop Environment”. Check back in a few days or follow us on RSS, Facebook or Twitter for that and more MTE goodness.