Now Reading
How to build a Linux Desktop Environment
[vc_row thb_full_width=”true” thb_row_padding=”true” thb_column_padding=”true” css=”.vc_custom_1608290870297{background-color: #ffffff !important;}”][vc_column][vc_row_inner][vc_column_inner][vc_empty_space height=”20px”][thb_postcarousel style=”style3″ navigation=”true” infinite=”” source=”size:6|post_type:post”][vc_empty_space height=”20px”][/vc_column_inner][/vc_row_inner][/vc_column][/vc_row]

How to build a Linux Desktop Environment

You’ve tried many different desktop environments and none of them have worked for you. Or maybe you like some components of a desktop environment and don’t like the others. Perhaps you should consider creating your own desktop environment.

How can I create a desktop environment?

It is easy to create a desktop environment by simply assembling components from existing desktop environments and other programs. It’s better to know the general components of a desktop environment before building one, but it’s not necessary. This is how you can build your own desktop environment.

Step 1: Create the Session BashScript

You will need to install a window manager to create a minimal desktop environment. This guide will use the kwin window manager. However, you can use any other window manager.

To install kwin in Ubuntu and Ubuntu-based Linux systems, type the following command into terminal:

 sudo apt install kwin --no-install-recommends 

Without the –no-install-recommendsoption, apt installs the entire kde desktop environment.

We will also add the plank dock into the desktop environment. To install it, type:

sudo apt to install plank

Now let’s create the session bash script. If you don’t already know, a bash script is a regular text file in which you enter a sequence of commands. The file executes the commands line-by-line and saves you the effort of typing each command in terminal.


Our script will contain the programs our desktop environment will need. We will place the script. /bin directory. So open terminal, and navigate to /binEnter the following command:

cd /bin

Then, create the script with the following command (we will refer to it

sudo touch 

Use your text editor to open the file as root, e.g. nano:

 sudo nano 

You can replace nano by any text editor such as gedit and xed.

Then, add the next line at the top.


This line tells terminal to execute the following script using bash

Next, type in the commands for the programs that you want to install on the custom desktop. Start with the window manger (in this instance kwin).

kwin &

The ampersand (&), after a command, makes it run in background so that the next command is executed immediately without waiting for the exit of the previous command. This is necessary because all the programs that make up the desktop environment must run simultaneously.

This script represents the desktop session. As long as the script is running, the session will continue to run. The session will close when this script finishes. You will be taken to the login screen, just like if you had 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 in the background, the script may exit and the session’s exit will occur as soon it begins.

After saving the script you can grant it executable permission. Type the following command:

 sudo chmod +x 

Step 2: Create the Desktop File

We need to create a custom desktop in order to make it visible when we log in. .desktopSend in /usr/share/xsessionsThis will point you to the script. To navigate to the directory, use the terminal type

cd /usr/share/xsessions 

Next, create the file and then open it by:

sudo touch custom_de.desktop
sudo nano custom_de.desktop

In the file, add the following lines:

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

For Exec=Enter the location of the session you have previously created.

nano_text_editor desktop entry

Step 3: Launch your Custom Desktop Environment

To launch your desktop experience:

  1. Log out
  2. Check out the complete list of desktop environments that have been installed
  3. Choose the new desktop environment
  4. Log in again

You can exit this session by killing the last program in your session script with the pkill command.

pkill plank 

Make your Desktop Environment more complete

Congratulations! You’ve created your own desktop environment.

But it’s still missing some components. It’s now time to add wallpaper and a panel.

There are many wallpaper-setting tools available. Komorebi is a good choice. It allows you to set videos as wallpapers and also displays desktop icons.

Download the deb package to install komorebi GitHub repositoryIt is easy to install, run, and then it will start.

We will use lxqt panel to create the panel.

sudo apt-panel install lxqt 

Don’t forget to put the lxqt-panel command and komorebi in the session script followed by ampersand (&). The full path to the komorebi command should be used (/System/Applications/komorebi).

nano_text_editor plank

Ulauncher is a useful application launcher that you might consider adding to your desktop. This will make your desktop experience even more complete.

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

You can add as much software as you like to your desktop and personalize it to your liking. You might also consider adding a notification manager.

How to set the GTK and Icon Themes

You can also change the GTK or icon themes in other desktop environments by using a GUI utility such as gnome-tweaks. In our case, we don’t have these utilities, but don’t worry as you can also change themes from command line by using gsettings command.

For gsettings effects to take effect, dbus should be running.

Dbus is used in its initial use dbus-launch. Just add dbus-launch bashAt the beginning of your script.

nano_text_editor launch bash

Next, exit the session to log back in. To see the GTK theme currently in use:

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


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

You must identify the theme you want to set. /usr/share/themes directory. The folder name is the theme name.

Linux desktop with mountain wallpaper

The Ultimate Customization Experience

While creating your own desktop environment is refreshing, it may not be the best experience. You can improve your desktop environment by adding other programs. ArchLinux will allow you to create your own Linux distro if you are a builder.

switching to a window manager
7 Things You Need to Know Before Switching To A Window Manager

Do you want to replace your current desktop environment by a window manager. These are the things you need to know before you make that decision.

Continue reading

About the Author

View Comments (0)

Leave a Reply

Your email address will not be published.