O'Reilly logo

Linux Annoyances for Geeks by Michael Jang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. Configuring a Desktop Environment

I start the list of annoyances at the desktop, as that's where most new users learn to work with Linux. While most geeks believe in the command-line interface, new users demand an intuitive GUI configured with the applications they need. To add to configuration demands, many organizations demand a standard desktop environment, with a common set of applications, icons, login managers, and so on. Cleaning up every last detail can be annoying for the geek.

In this chapter, I illustrate some of the annoyances related to configuring the desktop environment.

I Want the Advantages of Both KDE and GNOME

The major question for a Linux user or site administrator, after the selection of a distribution, is which graphical desktop environment to use. While this annoyance focuses on the two major desktops (GNOME and KDE), there are over a dozen other options you can install on the major Linux distributions.

Whatever your choice, you can still take advantage of applications associated with either desktop and other applications that use the X Window System or display their output on a terminal. In this annoyance I show you several ways to integrate KDE applications into a GNOME environment and vice versa.

Each distribution has its preferred desktop. Ubuntu originally went to an extreme, shipping with just GNOME; later the developers created the Kubuntu project to include KDE support. If you choose something other than the preferred desktop in any distribution, expect to do more administration and fix some glitches. Another criterion that can affect your choice is the background of the new user coming to Linux from another operating system. As shown in this annoyance, KDE more closely resembles Microsoft Windows, and GNOME more closely resembles the Apple Macintosh.

While most Linux administrators prefer to configure using the command-line interface, I use GUI tools where possible in this annoyance. This is because when you're configuring a GUI, it's important to be in the GUI to confirm that your changes match your intent.

Basics of GNOME

GNOME is short for the GNU Network Object Model Environment. The current version of the GNOME Desktop (2.12) has a look and feel similar to the Apple Macintosh GUI. The default settings include menus, dates, and system information applets on a top taskbar and a list of currently open applications in a bottom taskbar, as shown in Figure 1-1.

A typical GNOME desktop

Figure 1-1. A typical GNOME desktop

GNOME is the default desktop environment associated with the most popular Linux distribution, Red Hat/Fedora Linux. It provides GUI-based configuration tools through a variety of icons under the Control Center submenu.

Basics of KDE

KDE is short for the K Desktop Environment. The current version of the KDE desktop (3.5) has a look and feel similar to the Microsoft Windows GUI. The default settings include menus, dates, and system information applets on a bottom taskbar (see Figure 1-2). The K Menu button in the lower-left corner works in a fashion similar to the Microsoft Windows Start button.

A typical KDE desktop

Figure 1-2. A typical KDE desktop

KDE is the default desktop environment associated with most Linux distributions, including SUSE Linux. KDE centralizes GUI-based configuration tools within its Control Center.

Configuring KDE Applications on a GNOME Menu

Some distributions preconfigure applications in the appropriate GNOME menu. For example, when I install the Synaptic Package Manager on a GNOME Debian Linux desktop, it automatically includes a link from the System → System Settings submenu. But while it is less friendly to KDE applications, you can still include them in the GNOME menu. I'll show you how you can configure them on a single computer using the GUI, and then how to tweak a configuration file, a solution you can automate through a script and therefore share with a large number of users on your network.

As this section shows, it's easy to change menus by editing the configuration files for each user. But this flexibility contains its own annoyance for site administrators, because it means all users can edit their own GUI menus. That may be a problem for managers who want a standard GUI desktop. If you want to freeze your users' menu configurations, see the "My Users Mess Up Their Desktops" annoyance later in this chapter.

Customizing the GNOME menu

If possible, I recommend that you use the Simple Menu Editor for GNOME (SMEG). It is easy to use. But as of this writing, none of the distributions that we examine in this book use SMEG. (However, it is available as part of the alacarte RPM in the Fedora Extras repository.)

Alternatively, you can start the Nautilus File Browser and then open a window that specifies the applications in the main menu. For the purposes of this example, I'll add the KOffice Write application under the Office submenu. To do so, take the following steps, which apply to older versions of GNOME (=< 2.8) associated with active distributions such as Red Hat Enterprise Linux 3 and 4:

Tip

To find the applications listed in your GUI menus, run the gnome-menu-spec-test command, available from the gnome-menus-devel RPM in Fedora or the gnome-menus RPM in SUSE. You'll have to edit the .desktop files shown by the tool. Whenever you delete a file from this directory, the associated application is immediately removed from the GUI menus. Alternatively, you can use these files as a template for adding menu items; as they are text files, they are readily editable for new menu items. Once you've made your changes, you can share them with other systems on your network, and they'll apply to all users.

  1. In a command line in a GUI desktop, run the nautilus command. This opens the Nautilus browser.

  2. Press Ctrl-L. In the Location text box, navigate to applications:///. This opens the Applications window. Compare the entries to what you see in your Applications menu. They should be nearly identical. My version is shown in Figure 1-3.

  3. Use the Office icon to open a window that shows the current items in the Office submenu. Right-click in the menu and select Create Launcher from the pop-up menu.

  4. In the Create Launcher window, enter the information associated with the application. In this example, to add the KOffice Word application, in the Name text box, enter KOffice Word, which is what gets shown in the Applications submenu.

  5. In the Comment text box, enter a name that will be shown when the user hovers the pointer over the menu item.

  6. In the Command text box, enter the complete path, /usr/bin/kword.

    If you can't find the complete path to your desired application, the locate command can help. For more information, see the "I Don't Remember Where That File Is" annoyance in Chapter 2. If you know the name of the file, the dpkg -S packagename or rpm -ql packagename commands list all files installed from the package.

  7. Click Icon to see options for icons you can link to this entry. Alternatively, click Browse to find the icon you prefer.

  8. When you click OK to exit from the Create Launcher window, the item is added to the menu and is ready for use.

Editing the GNOME Applications menu

Figure 1-3. Editing the GNOME Applications menu

Sharing the custom GNOME menu

Now you can share your changes with other systems configured to use GNOME. All you need to do is share the files in the ~/.gnome2/vfolders/ and ~/.gnome/apps/ subdirectories, to make them a part of the home directory of each user. The activities in this section do not actually install KOffice Write, of course; you must do that separately.

To make sure these changes are part of the home directories of new users, add these files and subdirectories to the /etc/skel directory. They're then automatically added to the home directory of every new user you create.

To make sure they're part of the home directories of existing users, you need to adapt your solution to the particular distribution you're using. You could copy the subdirectories directly to each user's home directory, but you also have to assign ownership and read permissions to each user. Default permissions vary slightly by distribution.

Alternatively, you could edit the base configuration files directly; they're located in the /etc/gnome-vfs-2.0/vfolders directory and are in XML format. If you choose to edit these files, back them up first! Once you've edited them and tested them to make sure they aren't corrupt, you can copy them to the other systems on your network.

Configuring GNOME Applications on a KDE Menu

While Linux distributions preconfigure many GNOME applications under the appropriate KDE menus, you'll need to do more to complete the job. Not all applications are picked up by the KDE desktop. KDE may even miss some that are not GNOME-specific applications.

Tip

One option that goes beyond GNOME to other X Window System applications (also known as "legacy applications") is the KAppfinder tool, which scans your executable directories for applications you can add to your KDE menu. Start this tool with the kappfinder command.

Customizing the KDE menu

For this example, I decided to include the XWhois application under the KDE Internet submenu. To do so, take the following steps:

  1. As a regular user, run the kmenuedit command. This opens the KDE Menu Editor shown in Figure 1-4.

    If you encounter an error message, such as failed to create /home/michael/.config/menus/, you may already have a .config file in your home directory. You'll have to move it. If you see an error message such as kmenuedit: WARNING: Could not read /home/michael/.config/menus/applications-kmenuedit.menu, which tends to appear the first time someone uses the KDE Menu Editor on a given desktop, ignore the message.

  2. Note how the lefthand pane matches what you see when you click the K Menu button in the lower-left corner of your desktop.

  3. Highlight the submenu of your choice—in this case, the Internet menu.

  4. Click File → New Item. This opens the New Item window, where you can enter the name you want to see in the K Menu. Here, I use XWhois. Click OK.

  5. Back in the Menu Editor, you'll see the Internet submenu open, with the new entry. You can now add a Description and Comment of your choice in the respective text boxes.

  6. In the Command text box, enter the path to the application. In this case, on Debian Linux, it's /usr/bin/xwhois.

  7. If you want an icon for this application, click on the icon to the right of the Name and Description text boxes. This opens a list of icons in the /usr/share/icons subdirectory. (The actual icon files may be deep in this sudirectory.) I've used an icon that came with the xwhois package.

  8. When you're done, click File → Save and then File → Quit. KDE saves the changes to the applications-kmenuedit.menu file associated with the error message described in step 1.

The KDE Menu Editor

Figure 1-4. The KDE Menu Editor

Sharing the custom KDE menu

Now you can share your changes with other systems configured to use KDE. All you need to do is share the applications-kmenuedit.menu file in the ~/.config/menus/ subdirectory, to make it a part of the home directory of each user you've configured with KDE.

To make sure these changes are part of the home directories of new users, add this file to the appropriate subdirectory of the /etc/skel directory. It's then automatically added to the home directory of every new user you create.

As with GNOME, you need to adapt to each distribution in adding changes to the home directories of existing users. You could copy the subdirectories directly to each user's home directory, but then you also have to assign ownership and read permissions to each user, and these permissions vary slightly by distribution.

Alternatively, as with GNOME, you can edit the generic KDE configuration files directly; they're located in the /etc/xdg/menus directory and are in XML format. Back the files up first in case you make a mistake. After editing them, you can copy them to the other systems on your network.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required