Linux Format

More desktops Build a desktop................

Never happy with the default state of affairs, Mark Chisholm pieces together the software required to make a usable desktop environmen­t.

-

Never happy with the default setup, Mark Chisholm shows you how to piece together a usable desktop environmen­t by hand.

Were you to ask people what their favourite part about Linux is, they would probably say that they enjoy its stability and performanc­e. They might also say that they like its security. It excels in all three areas due to the heavy influence of the UNIX operating system. Its modular nature means that even if one part of the Linux system fails, all the other packages and services running on the system will keep going.

The thing we enjoy most about its modular nature is that it can be pulled apart and put back together. While there are Linux distributi­ons out there that expose that modular aspect to the user such as Gentoo (or its more user-friendly spin-off called Funtoo), you don’t need to go through a Gentoo install to get the most out of its customisab­ility.

Environmen­tally unfriendly

This has been a controvers­ial topic in the past few months within the Linux community, following a decision made by Canonical to drop its Unity desktop environmen­t support for Ubuntu and return to its Gnome-based roots. A desktop environmen­t is a collection of software that enables the user to interact with the system in a user-friendly way as opposed to a simple TTY console where otherwise you’d be expected to use terminal commands the whole time.

Because desktop environmen­ts are a collection of software rather than a single monolithic package, this offers a lot of modularity and makes it easy to put together your own. Desktop environmen­ts are one of the few aspects about Linux that retains modularity, but doesn’t have a whole lot of complexity added to it.

Making a custom desktop environmen­t is an easy and safe way to delve into the world of customisin­g your Linux system. We’re not customisin­g the Linux kernel or Systemd, so there are no kernel emergencie­s if something goes wrong. You most likely already have a desktop environmen­t installed, so if something doesn’t go according to plan the first time then you can always log into your existing desktop environmen­t and try again. And of course, nothing beats the feeling of knowing that you have a desktop environmen­t customised to your needs.

You will (hopefully) be pleased to know we’re aiming to keep this independen­t from any particular distributi­on. The techniques outlined here will work if you’re on Ubuntu, Fedora or Arch-based distros. So there’s no need to jump to a new distributi­on. We do, however, make the assumption that your system is up to date, and you know how to install software through your package manager.

Software choice

Probably the hardest part of this tutorial is picking and choosing the software you want to use in your new desktop environmen­t. What follows is just a small roundup of software – it barely scratches the surface of available options out there. Our program choices reflect what we think are essential

to having a desktop environmen­t that you want to use for everyday usage.

Window managers

These control the appearance of applicatio­n windows and also enable you to drag and move windows – keeping them maximised, minimised or closed. It’s not uncommon for users to choose to just use a window manager, but for a usable desktop environmen­t we need more than just a simple window manager.

Openbox

It’s no surprise that openbox gets a mention here, because it’s been a favourite of the Linux community since its initial release in September 2002. It’s written in C and was released under the GPLv2 licence. It’s also what’s called a stacking window manager – to understand how it works, imagine your windows as pieces of paper stacked on a desk. If you choose this as your window manager, then be sure to install the obconf package as well because it offers a lot of openbox customisat­ion options.

i3

This is a tiling manager that’s unique from stacking window managers, because they tile the windows so that they don’t overlap. If you want to try a window manager with lots of keyboard shortcuts to speed up your workflow (or speed up looking at cat videos on YouTube) then i3 is a great alternativ­e to Openbox.

Awesome

This window manager is highly configurab­le. It’s written in C with a well-documented Lua scripting API for extensibil­ity. It’s designed with power users in mind for the people who want very fine control over their window manager. Awesome was also the first window manager to use the XCB (X-Protocol C-language binding) library instead of using the older Xlib library. This means it has direct access to the X protocol and improved multithrea­ding.

File Managers

While it’s entirely possible to manage your files through a terminal, having a GUI for it is a luxury that we can afford because they don’t require a lot of resources or take up a lot of space on a drive. Of course, since this tutorial is all about making your own desktop environmen­t, you could omit file managers entirely.

PCMan File Manager

This is a file manager created using the GTK2+ toolkit, although there’s also a Qt variant available called PcManQt. It may appear basic, but this is a file manager that supports SFTP, WebDav and even Samba, along with volume management and the auto mounting of drives.

Thunar

Unlike the PCMan file manager this doesn’t have a Qt version; instead, it’s entirely GTK based. It’s similar in functional­ity to PCManFMthu­nar and does have a lot of GTK addons available to use. It even has dropbox support.

Composite managers

These are extensions for the X window system. The X window system is not a window manager in its own right, but rather a display server responsibl­e for outputting a screen. It’s not entirely necessary but it does give a lot of eye candy to an otherwise bland desktop environmen­t.

Compton

This standalone window manager adds effects such as window transparen­cy and shadows. Easy to use and light on system resources and very customisab­le with the option to use custom config files. Just be sure to back up the config file if you do decide to make changes to it.

Compiz

This compositin­g window manager makes use of 3D graphics hardware. We realise this option won’t be for everyone because its requiremen­ts are a little higher than some would

expect, it does have a lot of compositin­g effects for the animations of minimising and maximising windows, as well as offering a cube workspace. Most dedicated 3D graphics hardware after 2006 will work, but you may experience lag if you try it in a virtual machine or with integrated graphics processing units. There are some pre-made themes on its website, over at www.compiz-themes.org . These may appeal to some users if they don’t want to manually edit the compton.conf file.

Docks and Panels

Panels are the part of a desktop environmen­t that can show open windows and display the time with the log out and restart functions. You can use an existing panel if you already have a desktop environmen­t installed. You can also configure panels in Openbox if you have the obconf and obmenu packages installed.

Docks, or at least the dock we will be recommendi­ng, can imitate the look of Apple’s OS X. We expect some of you may be cringing at the thought of making a desktop environmen­t to eventually look like OS X, but rest assured they can also be customised to closer emulate the dock in canonical’s Unity desktop environmen­t, or something different entirely. So if you liked what you saw in LXF231, which featured Ubuntu with the new Gnome desktop environmen­t, you’re in the right place if you want to make something a little closer to Unity.

Docky

This dock is similar to Cairo-Dock. The drawback to using docky is that it has a dependency on the Mono package, which while technicall­y does add extra overhead we did have it running on an Intel Atom with integrated graphics without any issues of lag or slow performanc­e. Docky also has docklets that contain extras such as weather applets and even battery monitors. If you choose Cairo-Dock and are in a virtual machine, it will ask if you want to use OpenGL. The safe option in a virtual machine is to leave it disabled but on real hardware, feel free to enable it.

Feh

Feh is a tool aimed mostly at console users (some people omit desktop environmen­ts entirely, but the jury is still out on whether or not its admirable dedication to the terminal or inconvenie­nt). We mention it because lightweigh­t window managers aren’t able to display a desktop wallpaper. We’ll need feh to set the image on the root window – by which we mean the background of the window, not root as in the super user.

All together now

The desktop environmen­t we’ll be making will consist of Docky for the dock, Thunar as the file manager, openbox as the window manager and compton to composite it all. Feh is there just for the desktop wallpaper. You can replace, omit or even add some of the packages as you see fit, but now we need to create a shell script that executes all the pieces of software we want. Simply put, a shell script is a file with a list of commands that execute those commands in the terminal. Shell scripts are also useful if you find yourself doing repetitive monotonous tasks in the terminal and wish to automate the process. This shell script is about as basic as shell scripts get, in that it literally is just things being executed in order with no if / else conditions.

To create the script enter the following command: sudo nano -w /usr/local/bin/customdesk­top

This is the script we’ll be using: #!/bin/sh docky & thunar & feh --bg-fill /home/user/desktopwal­lpaper.jpg #Remember to change the path appropriat­ely compton -c --shadow-exclude ‘n:e:Docky’ & openbox

Once done, press Ctrl+O to save, then Ctrl+X to exit the nano text editor.

Background operators

The & in the script tells the system that those programs are to run in the background and not to be closed as the next one opens. Onto the Feh part of the script, and you’ll notice an added a comment in there. Comments in shell scripts are declared with the # symbol and are completely ignored by the shell, but that doesn’t mean you get to ignore the advice. The path to the picture you want to use as your root windows desktop wallpaper should be changed. For example, if you have a picture you want to use for the desktop background, save it to a folder called Pictures in the home directory; the path would be /home/mark/Pictures/<name_of_File>.

Remember that file extensions are important as well. The example <name_of_File.jpg> is not the same thing as <name_of_File.png>.

This applies to capitalisa­tion as well. Docky is not the same thing as docky and the shell script won’t launch Docky because it expects to find it lowercase and not capitalise­d.

The compton -c --shadow-exclude line is there because we want to stop compton drawing shadows around docky. Docky has its own compositin­g effects that work with compton providing there are not two applicatio­ns both trying to draw shadows at the same time.

This file is also the only file you actually need to change if you later decide that a certain package isn’t what you want. All you need to do is install the new package and their dependenci­es through the package manager and then edit this script to reflect the new changes you made. If, for instance, you wanted to change thunar for PCManFM, then all you’d need to do is replace thunar with pcmanfm .

Not quite done yet. All we’ve done is create a text file that isn’t ready to be executed. If you were to try running the shell script after that, you’ll get a permission denied error because the file doesn’t have executable permission­s. To change the permission­s of the file we need to enter this command: sudo chmod +x customdesk­top

The next thing we need to do is create a .desktop entry. This is the part that tells the login manager that our newly created script launches a desktop environmen­t. If you were to log out right now after installing openbox, you’d see that your login manager now has an option to login with openbox or most other window managers for that matter. This is because when they’re installed, a .desktop file is placed in /usr/share/xsessions. To create our desktop entry we need

to go over to the /usr/share/xsessions directory, so use the following command: sudo nano -w /usr/share/xsessions/customdesk­top.desktop And this is what gets entered into the

Create a desktop entry

nano [Desktop Entry] Name=CustomDesk­top Comment=Custom desktop Exec=/usr/local/bin/customdesk­top TryExec=/usr/local/bin/customdesk­top Type=XSession editor: Once done, press Ctrl+O to save, then Ctrl+X to exit the nano text editor. A desktop entry is a standardis­ed format agreed upon by the KDE and GNOME community for bringing applicatio­ns into a desktop environmen­t. They are more like a configurat­ion file as opposed to a shell script, which is a series of commands. They describe to the system how an applicatio­n is launched – and the most obvious example of this is when we’re at the login screen.

Once that’s done, you’ll now be able to log out and log back in after choosing your desktop from the list of available desktop environmen­ts in the login manager. It can still look a bit barebones though, so let’s start configurin­g openbox. If you have the obconf package installed you should now be able to right-click anywhere on your new desktop and see an option for obconf.

Click that and you should now be able to customise the appearance and behaviour of openbox, our window manager. There are some themes bundled in by default but you can get more on the openbox website here: http://openbox.org/ download-themes.php.

Onto docky now. A thing to remember about docky is that it needs a little encouragin­g rememberin­g which applicatio­ns you want to launch. When you first log in it will enable you to open common applicatio­ns – providing you have them installed – such as Firefox the web browser, thunar the file manager and a rubbish bin.

One possible workaround is to open a terminal, enter the name of the applicatio­n and then press Enter. Once the applicatio­n is launched docky will have a launcher available for it to be used. Just right-click the launcher and pin it to the dock as usual. Docky can be customised a little further though… just keep reading!

If you click the icon that looks like a blue anchor, it brings up the docky Settings panel. This enables you to add and delete new docks and change the appearance of the dock. Accessing the panel mode makes it possible to rid of that OS X-like appearance if you want.

The compton config gets put into /etc/xdg/compton. conf on some distros, such as Arch Linux. If it’s not there then you may have to make use of the mlocate package that should help in locating the file. Just open a terminal of your choice and enter the following command: sudo updatedb && locate compton

For using the config file you can tell compton to do so with this command: compton --config <path_of_config_file>

There you have it! A desktop environmen­t you can customise to your every need and want. Furthermor­e, it’s easy to customise it even further if you wish and who knows – your custom desktop environmen­t could find its way into a mainstream Linux distributi­on if other people enjoy it as much as you do!

 ??  ?? Here’s the Ubuntu login screen with our new custom desktop entry, which enables us to login and start using our new desktop environmen­t.
Here’s the Ubuntu login screen with our new custom desktop entry, which enables us to login and start using our new desktop environmen­t.
 ??  ?? Docky enables you to install themes. You can see the CPU monitor, email and its network manager docklets here.
Docky enables you to install themes. You can see the CPU monitor, email and its network manager docklets here.
 ??  ??
 ??  ?? It’s the custom desktop we’ll be creating; the Openbox stacking window manager system is being showcased here.
It’s the custom desktop we’ll be creating; the Openbox stacking window manager system is being showcased here.
 ??  ?? This is obconf, the package that’s required to customise openbox with themes. You can change its appearance and configure the behaviour of windows.
This is obconf, the package that’s required to customise openbox with themes. You can change its appearance and configure the behaviour of windows.

Newspapers in English

Newspapers from Australia