How to Easily Create a Custom Lightweight Desktop Environment

Gnome and KDE are great – they give you a beautiful desktop with all the tools and utilities you need. On either system, you’ll find a solid window manager, desktop icons, a panel full of applets, the works. That’s all well and good for your average desktop PC, but what if you need something lighter, faster, or cleaner in appearance? You could try a smaller desktop environment like XFCE or go with something ultra-slim like Openbox or WindowMaker. On the other hand, you could get exactly what you want, no more no less, by combining individual pieces together into your own custom desktop environment.

How?

When you run Gnome, you’re not running a single application. Gnome launches Metacity (optionally Compiz) to handle window management, gnome-panel to serve as the panel and menu system, and various applets and tools for things like power management and Bluetooth support. Each of these is independent of the others and can be replaced or launched on its own.

What we’ll be doing today is specifying our own list of applications (window manager, dock, etc) to run on login, completely bypassing the likes of Gnome and KDE in favor of our custom apps. There are a few methods of achieving this, and the one demonstrated here was chosen to be functional, simple, and not very distribution-specific.

Designing Your Desktop

To create a functional DE, you’ll need a few basic parts:

  • Window manager (Metacity, Compiz, etc)
  • Application launcher (Gnome-Do, Kupfer, etc)
  • Panel/Dock (Docky, Cairo Dock, PyPanel, etc)
  • Wallpaper manager (bsetroot, hsetroot, etc)
  • Optional panel applets, desktop widgets, etc

This guide will use Compiz, Gnome-Do, Cairo Dock (with applets), and hsetroot to achieve all the needed functionality. Using Compiz as the base window manager gives us the full set of Compiz plugins like Expo and Zoom. All those packages should be available in the standard repositories of most distributions. Ubuntu users can fetch them from the Ubuntu Software Center or with the terminal command:

Most of these applications have been discussed in detail on MakeTechEasier. Use our search box to gather more information on which tool is the best for your needs.

Some other usable setups could include dropping the dock/panel entirely and using Gnome-Do for all app launching needs, or adding something like Conky or Google Desktop for system monitoring.

Creating the List

Now that you’ve got an application chosen for each of the roles above, we can begin creating a list so that they will be run on login. Begin by opening any text editor of your choice, and writing out the names of the programs to be run. End each of the lines (except the last) with a &. This symbol tells Linux to run the program in the background and move on to the next item. Without the &, it would run the first line and wait until that program was completed before running the next. That could, for example, prevent the dock from loading until after the window manager is closed – clearly not what we want.

customde-script

When finished, save the file to any directory you choose (your home is fine) and take note of the file’s name and location. As my name is Josh, I have the file saved in /home/josh/customDE.sh.

Adding to GDM list

In what I’m sure must be amazing coincidence, we recently wrote a detailed guide on precisely how to edit the GDM Sessions list to let you launch your own desktop environment.

In short, you’ll want to (as root) create a new file in the /usr/share/xsessions directory. The file should end with the .desktop extension, and follow a template similar to the following:

customde-xsessions

The only really important lines for this scenario are Name and Exec. Name must uniquely identify your DE so that you can recognize it in the GDM Sessions list. Exec must be the name of the file we created in the previous step, such as customDE.sh.

Save the file as /usr/share/xsessions/custom.desktop. Next time you logout, you’ll see your entry in the Sessions list in GDM.

Conclusion

If you’ve followed each of these steps, you created a list of applications you wanted in your DE, saved that list (with appropriate ampersands) into a script, then created a launcher in /usr/share/xsessions to start that script from GDM. Hopefully, your choices have left you with a feature-complete and beautiful desktop. Not only should it meet your specific needs, but there’s a good chance it’ll be far more responsive than a monolithic desktop system like Gnome.

customde-finished

If you’ve got desktop customization stories or suggestions for how to create your own, let us know in the comments!

25 comments

  1. With compiz it wont be very lightweight.

    I'm a ArchLinux user and my Desktop is:

    – Openbox (windowmanager)
    – tint2 (panel)
    – gmrun (launcher)
    – adeskbar (launch-bar)
    – guake (dropdown terminal)
    – feh (for setting wallpaper)
    – SLiM (login manager)
    – xcompmgr (for transparencys and stuff)
    – pytyle (manages tilling – I use it when programming)

    I think this way is a lot more lightweight and it looks gr8!:)

    ->clean
    http://img687.imageshack.us/f/20100810182823270…

    ->dirty1
    http://img809.imageshack.us/f/20100810182838270…

    ->dirty2
    http://img833.imageshack.us/f/20100810182857270…

    PS: the white rectangle in at the left screen its because I have dual-monitor setup, and the left one as a smaller resolution

    best regards!

    1. Someone on OMG Ubuntu said… How do you know a person uses Arch Linux?

      A: they make it a point to tell you :D

      Fellow Archer here :) Arch FTW!

  2. I had considered using Openbox as the example window manager, but I wanted to emphasize that you don't have to sacrifice the flashy effects, if you want them, in order to make your own desktop.

    Yours looks excellent! I had done something similar with conky & openbox because ob would let me specify a desktop margin where windows would not overlap, and I could leave my conky info bar running in view.

    I had never looked at SLiM until now, that looks like a great article topic. Thanks for the reply!

  3. SLiM is great because its very small and it does just what it is supposed to do without needing a lot of resources.

    keep posting about linux stuff, its always nice to read(:

    best regards!

  4. Very interesting article. I'm still learning about Linux….currently a Mint user. http://www.garyfarnam.org

  5. The only thing you're missing here that most people would probably consider part of a reasonably complete desktop environment are desktop icons. Good options for providing that are pcmanfm, idesk, and rox-filer.

  6. I suppose that's true – I rarely use desktop icons myself so it didn't really occur to me as an important part of a desktop environment. Thanks for the software suggestions.

  7. You're not slim unless you use a tiling window manager.

  8. Nice tutorial, thank you.
    What is the last line “X-Ubuntu-Gettext-Domain=gdm”? How to change it for another distro?

  9. The short answer is that it's there for translation purposes (long answer here http://en.wikipedia.org/wiki/GNU_gettext)

    That line in particular wouldn't matter if you were to go to another distro without gdm, however the .desktop file approach as a whole might not apply to another login manager.

  10. looking for something light but efficient? try fluxbox:

    http://fluxbox.org

  11. not true. openbox is really light. it only consumes me 3MB of ram in my dual head setup.
    by the way, I guess you confused SLiM login manager that I was talking about, with having a slim desktop.

    regards

  12. Have you tried LXDM??
    It's a great.

    1. Yeah. I like LXDM. My favorite is LightDM, though.

  13. GRRR!!! I’m missing out in all of this as my Linux laptop died and my desktop computer cannot run Linux as I have stoopid Netgear dongle!

  14. My home pc doesn’t have internet :(
    Where can I download a package that has all the applications making up the desktop in the tutorial??
    Thanks in advance.

    1. You. Don’t. Have. Internet????
      How do you cope?

  15. When i’m creating the list should i put –use-root-window after the window manager if i’m not using compiz?

    1. Sorry for the late reply, it seems I missed this comment when it was posted.  The technical answer is that it depends on exactly which WM you’re using, but the short answer is “probably not”.

  16. I have a couple of questions.  I’m trying to achieve a single effect: A small fixed number of windows always maximized and always running the same software (which may in turn be tabbed). Specifically, one of the following sets of software would be running at startup and no other software:  A browser, emacs; A browser, emacs, file manager; or a browser, emacs, a filemanager and a terminal.  The only thing that is needed is the ability to switch between windows (and thus apps) with a hotkey.  There is no need for a panel, but a launcher available from a hot key might be nice in case one of the apps crashes.  Oh, and I suppose there has to be a way of picking a wireless connection (that could be managed in the terminal)

    (I’ve outlined my goal here:  http://tinyurl.com/3t7koh2 )

    So, my questions are:  Can this be done with no panel or desktop icon capacity? If so, does that recommend a specific window manager? Are there window managers that don’t do windows at all, i.e., make everything full screen, or can one be recompiled to make this happen?

    If one eliminates the need for managing windows other than spawning a fixed arbitrary number of them, does that also eliminate the need for additional libraries? 

    What else am I missing?

    1.  Ok if I’m reading this right, I’ve got a few suggestions.  

      It sounds like you want certain apps to auto-launch on specific desktops, auto-maximized.  My long-time favorite window manager Window Maker can do all of the above, but I’m not sure it will be quite as graphically minimalist as you seem to want.  My first ever MTE post was on how to configure Window Maker in a way that I personally find to be far more productive than any other WM out there.  http://maketecheasier.com/create-a-great-window-maker-desktop/2009/02/14/

      For a *almost* completely minimalist desktop that can do most (possibly all, I’m not sure) of the above, OpenBox might be what you’re looking for.  I’m not certain if it can auto-maximize windows but I’m fairly sure you can start specific apps on launch and it’s extremely clean, graphically.  

      For a COMPLETELY spartan desktop, you can use Compiz as described in this article along with the Expo plugin to handle workspace management (I describe my personal favorite compiz setup here http://maketecheasier.com/extreme-desktop-makeover-josh-edition/2010/04/22/

      As you may be able to tell from those links, I have a very specific set of needs for my WM/DE. Currently I am running a desktop (compiz + expo) similar to that second link, but I have replaced nearly everything in the “info bar” on the right with a custom homegrown dock.  When it’s ready, it’ll be released open source.  

    2. Oh and regarding the additional libraries – 

      Window Maker has its own widget set outside the normal GTK/QT stuff.  It’s extremely light and fast, but many people find the aesthetics to be a bit lacking.   If you can get past that, I think it would do everything you requested exceedingly well.  

  17. This is in no way light…Compiz is in of its self is heavy, if you were wanting something with all the functionality of Compiz, you could use a box WM and then use a couple extra applications (3ddesktop, skippy-xd, and xdesktopwaves) with a composite manager (cairo composite manager, xcompmgr) and then you would have a truly flashy and light weight window manager. For docks, i would never use docky, again that’s very heavy, you should look at Wbar, Simdock, or Adeskbar for your docking needs. For Terminal and application launchers, gnome do is resource heavy and has Gnome dependencies, GMRun is a better alternative to gnome-Do, and the Basic xterm has what you need for terminal work. For wallpaper, you could use FEH, Nitrogen, or even PCmanFM if you wanted to.

    This guide is slightly misleading, but that’s my two cents.

  18. Excellent article!

    You should mention that the compiz is 2 things at the same time: a window manager and a composite manager. 

    Personnaly I use openbox with cairo-compmgr as a window manager & composite manager, it’s a lot lighter and slimmer than compiz.  feh for the background.

    Openbox use ~/.config/openbox/autorun.sh to start things when you open your session.  I put my stuff there and I use slim as a desktop manager, it is very minimal and light.

    You don’t mention automounting of devices.  That should be part of the desktop and is impacted by the distro (whether it’s with use hal, udev or else). 
    I haven’t installed gnome at all.  But for automounting I use uam (project part of xfce desktop, see https://github.com/mgorny/uam/ ).

    For those who are interested by openbox, here is my autostart.sh :
    =================================================
    #!/bin/bash
    /home/funtoo/dual_screen.sh
    setxkbmap -layout ca -variant multi
    DESKTOP_ENV=”OPENBOX”
    ~/.fehbg &
    xscreensaver&
    cairo-compmgr&
    cairo-dock -o -e xfce &
    thunar –daemon&
    exit
    ====================================

    As you may notice, I use xscreensaver and thunar as a filemanager.
    I’m very proud of my setup and it answers my needs of a slick and fast desktop with no compromise.

    The script “dual_screen.sh” is a script to check whether my other monitor is connected and activate the desktop on both monitor.  It use xrandr to configure the desktop the way I like it.

    Again, excellent article.  Keep on the good work.  Having a light desktop with all the functionalities you want is getting easier every day.

    regards,

              Bernard Tremblay
              Quebec, Canada
              public at imaginasys dot fastmail dot fm

Comments are closed.