X Session Desktop Environment Launch Menu (Python)

I like to run Arch Linux on systems that have a small amount of resources so that I can have a system with a small footprint. I also like…

X Session Desktop Environment Launch Menu (Python)
Photo by Chris Ried on Unsplash

I like to run Arch Linux on systems that have a small amount of resources so that I can have a system with a small footprint. I also like to have a desktop environment for running some GUI tools, but I don’t want things like a session manager running as I use TTYs and login via command line. When I do want a desktop environment, because I’m using a tool or I want to test something out (i,e. a new desktop environment update), I would like to launch it without installing a session manager (e.g. GDM or LightDM). That’s when I made this small Python script to grab the desktop environments I have installed and launch them under the current TTY that I’m on.

For this script, you will need Python installed, but that shouldn’t be a problem as most Linux distributions already have Python installed. I only tested the script on Arch Linux, but I can’t imagine it not working with other distributions too. It’s a very minimal script, and only really requires sx to be installed.

Once launched, and the requirements have been meet, the script will then get TTY the script is currently being run under. After getting the TTY, the script will then get the desktop environments that are installed by looking at the files GDM and LightDM would look at. The user will then be presented with the list of desktop environments that were found on the system, and prompt the user to select the desktop environment they would like to use. Once the user selects the desktop environment they would like to launch, the script grabs the execution command to launch the desktop environment from the .desktop file and then runs the command using sx.

The script is currently on GitHub:
https://github.com/martinoj2009/StartXsessionTty