How to create your own Desktop Environment in Linux

Have you tried many desktop environments (Desktop Environment) but none suits your taste? Or maybe you like some components of DE and don’t like others. Then you should build your own Desktop Environment.

How to build Desktop Environment in Linux

How to Build a Desktop Environment

You can easily build a desktop environment by assembling various components of an existing DE and other standalone programs. It is better to know the general components of the DE before building the environment, but this is not necessary. Here, I will show you how to build your own desktop environment.

Step 1: Create a Session Bash . script

To create a desktop environment, you need to at least create a window manager. In this article, I will use kwin window manager. But you can use any window manager you want.

To install kwin on Ubuntu and Ubuntu-based systems, enter the following command in the terminal:

sudo apt install kwin --no-install-recommends

Without the –no-install-suggest option, apt will install the entire kde desktop environment.

In addition to the window manager, we also need to add the dock. To install it, type:

sudo apt install plank

Now let’s create bash script session. If you don’t already know, a bash script is a regular text file in which you type command lines. When the file is executed, it initializes the commands contained in it line by line, saving you from having to type each command in the terminal yourself.

Our script will contain the programs that the DE will have. We will put the script in the /bin directory. So, open terminal and navigate to /bin by typing the following command:

cd /bin

Then create the script with the following command (we’ll call it

sudo touch

Open the file as root with your text editor, e.g. nano

sudo nano

You can replace nano with any text editor like gedit or xed.

Then put the following line at the top of the script.


This line tells terminal to execute this script using bash.

Next, enter the command of the program you want using the window manager (in this case, kwin).

kwin &

How to create your own Desktop Environment in Linux 25

The ampersand (&) after a command makes it run in the background so that the next command is executed without waiting for the previous command to complete. We need to do this because the programs that create the desktop environment need to run at the same time.

This script represents the desktop session, as long as this script is running the session will continue to run. When this script is disabled the session will exit and you will be directed to the login screen as if you were logged out.

That’s why it’s important not to put an ampersand (&) after the last command. If this happens and the last command is sent to the background, the script will exit and the session will exit as soon as it starts.

After saving the script, give it execute permission by entering the following command:

sudo chmod +x

Step 2: Create a screen file

To display our custom screen during login, we have to create a .desktop file in /usr/share/xsessions, which will point to the script. To navigate to that directory, enter the following command:

cd /usr/share/xsessions

Then create the file and open it with the command:

sudo touch custom_de.desktop
sudo nano custom_de.desktop

Inside the file write the following lines:

[Desktop Entry]
Name=Custom DE
Comment=My awesome desktop environment

For Exec=, enter the location of the script you created earlier.

How to create your own Desktop Environment in Linux

Step 3: Launch the custom Desktop Environment

To launch your desktop environment, perform the following steps:

  1. Log out
  2. Find a list of installed desktop environments
  3. Select the newly created desktop environment
  4. Re-login

To exit this session, kill the last program in your session script with the pkill command:

pkill plank

Make your desktop environment more complete

You have successfully created your desktop environment.

But it still lacks some components. It’s time to add backgrounds and panels.

There are many ways to set the wallpaper but the best choice is Komorebi, which gives you the ability to set a video as wallpaper and it also displays icons on the desktop.

To install komorebi, download the installation package from the GitHub repository, install and run it.

For the console, I will use the lxqt console:

sudo apt install lxqt-panel

Don’t forget to put the lxqt-panel and komorebi commands in the session script, followed by an ampersand (&). Use full path for komorebi command (/System/Applications/komorebi).

How to create your own Desktop Environment in Linux

You can also add Ulauncher, a useful app launcher. This will make the desktop experience more complete:

sudo add-apt-repository ppa:agornostal/ulauncher && sudo apt update && sudo apt install ulauncher

You can add as many programs as you want, customizing the display to suit your needs. You should also consider adding a notification manager.

How to set GTK and Icon Themes

In other desktop environments, you can change the GTK and icon theme using a GUI utility like gnome-tweak or other Themes. In our case, we don’t have these utilities, but don’t worry because you can also change the theme from the terminal using the gsettings command.

For the setting to take effect, dbus must be running.

Dbus uses dbus-launcher. Just add bash dbus-launcher at the top of your script.

How to create your own Desktop Environment in Linux 28

Next, exit the session and log back in. To get the currently applied GTK theme:

gsettings get org.gnome.desktop.interface gtk-theme

For example, to set the GTK theme to the Canta theme, type:

gsettings set org.gnome.desktop.interface gtk-theme Canta

The theme you are going to install must be in the folder /usr/share/themes. The theme name is its folder name.

In addition, you can also see 5 more tips to decorate the Terminal interface here.

Leave a Reply