ONLamp.com    
 Published on ONLamp.com (http://www.onlamp.com/)
 See this if you're having trouble printing code examples


FreeBSD Basics

Customizing Your Desktop Environment

06/28/2000

One of the most addictive activities a computer geek can engage in is tweaking his desktop settings to reflect his own taste and personality. Most of the Window Managers that run on The X Window System allow you to customize your menu options and wallpaper. Unfortunately, you'll also find that most Window Managers aren't ready to use "as is," since they come with shortcuts to applications that haven't been installed yet and don't necessarily have shortcuts to your favorite applications. And unless you've used a specific Window Manager before, you may spend a lot of time figuring out how to change the defaults. This article will help you get started on the XFCE Window Manager.

Let's assume you've just installed XFCE from either the package or the port and want to check it out. To launch XFCE, you can type:
startx xfce.
Later on, if you decide you like XFCE, you can save yourself future keystrokes by editing the .xinitrc file located in your home directory so that it only contains these lines:
exec xfce.
Now you'll just have to type:
startx.
A program named xinit will read the .xinitrc configuration file in your home directory and start XFCE for you.

Once you've launched XFCE, let's start looking around. OK, boring gray zigzag wallpaper, and a menu bar with some icons. If you start clicking on icons, some will execute applications, while others won't seem to do anything. If you click on the arrow above an icon, you'll discover a pop-up menu with shortcuts to other applications; if you click on all eight arrows, you'll end up with eight pop-up menus. It might take a couple of minutes to figure out you have to click the arrow again to close the pop-up menu. If you start clicking on applications in the pop-up menus, usually nothing happens. It's time to start customizing.

Let's start with the arrow on the far left. It has entries to mount and unmount floppies and CD-ROMs; unfortunately, the commands are incorrect for your FreeBSD system.

When you wish to mount CD-ROMs or floppies in Unix, you can shorten the mount command, which forces it to read a configuration file called fstab. We'll need to double-check that this file contains the information that the menu option requires.

Open up an xterm by clicking on the icon that has a monitor with a red check mark in it. You'll notice that you can only type in this xterm if your mouse is hovering somewhere within the white box.

more /etc/fstab

Near the bottom of this file should be two entries like this:

/dev/acd0c   /cdrom    cd9660   ro,noauto   0   0
/dev/fd0     /floppy   msdos    rw,noauto   0   0

If there isn't, as root, use your favorite text editor to add them; remember to carefully double-check your changes before saving them.

We'll also need to double-check that we've created empty directories to use as mount points for the floppy and the CD-ROM. Try this:
cd /
ls

Check that you have directories called cdrom and floppy. If not:

mkdir cdrom
mkdir floppy

When you are finished, type exit to close the xterm.

Let's return to the pop-up menu; right-click on the Mount CDROM option to enter its configuration screen. Notice that the entry in the Command Line: section is incorrect. Use your mouse to highlight /mnt and your delete key to delete that text. It should read:

mount /cdrom

Click OK to save your changes.

Repeat this process for Unmount CDROM, Mount Floppy, and Unmount Floppy. The corrected Command Line: entries should be:
umount /cdrom
mount /floppy
umount /floppy

Make sure you have a floppy in the floppy drive and a data CD-ROM in the CD-ROM drive before testing your new menu commands.

If you're root, the floppy and CD-ROM should mount successfully. If you open an xterm and type:

cd /floppy
ls

you should be able to see the contents of the floppy and

cd /cdrom
ls

should show the contents of the CD-ROM.

And, df should show both as mounted:

df
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/fd0         1424       28     1396     2%    /floppy
/dev/acd0c     470754   470754        0   100%    /cdrom

However, if you're not root, nothing will happen. If you press Ctrl-Alt-Fx, where x is the number of the terminal you originally typed startx at, you'll see the following error messages:

cd9660: Operation not permitted
msdos: /dev/fd0: Operation not permitted

You may have issued the command from XFCE's menu option, but a Windows Manager must still abide by the rules of the Unix system it is installed on.

"No problem," you might think to yourself, "if that user is a member of the group wheel, I'll just open an xterm and su to root." However, if you try that, you'll still create the same error messages if you use the menu option to mount the floppy or CD-ROM. However, if you use the xterm to issue the mount commands, they will mount.

We've just discovered a Catch-22. If you open a Window Manager as a regular user, you'll receive that regular user's customized desktop, and the menu options will have the privileges of the regular user. If you su to root and then open a Window Manager, you will receive root's desktop, not the original user's.

Therefore, if you are customizing a desktop for a regular user, you might as well remove the menu options to mount and unmount file systems. To do this, right-click the option and click on the Remove button, then click on the Yes button when you are asked if you're really sure.

The other two options in this pop-up menu are installed and work by default. You can remove them if you don't like them, change their default icon by right-clicking on the option and browsing through the Icon File: list, or change the text that appears in the menu by editing the Label: section.

Now it's time to start installing packages and adding them to the pop-up menus. Use Ctrl-Alt-Fx to open another terminal and log on as root. Type:

/stand/sysinstall
Configure
Packages
Choose your Installation Media

and wait for the Index to be read. As you browse through each category, there will be a short description of each package as it is highlighted. To choose a package, use your spacebar to mark it; press OK to leave that category and choose another one. When you are finished making your selections, arrow over to Install. You'll be presented with a list of your selections. It's not a bad idea to write these down if you are installing a lot of packages so you'll remember to add them all to your Window Manager menu. Press OK, and the packages you've selected will be installed.

If you are new to the packages collection, you may be unsure of which packages to try first. For a regular user, I usually build the following:

Deskutils>Ical

A very functional calendar utility

Deskutils>xmaddressbook

A nice GUI address book

Editors>AbiWord

A text editor that looks like Word, without the overhead; also reads/writes to *.rtf, *.doc, and *.txt files

Games>Pysol

Solitaire to rival any other Solitaire version

Games>Xbill

Great for when you need to vent some frustration

Games>xmahjongg, xchomp, xtet42, pacman

More games.

Graphics>Gimp

For all your graphics manipulation needs

Graphics>xv

To view all those images you receive in your e-mail

Mail>Fetchmail

So you can retrieve your e-mail

Mail>Balsa

For those who want a Eudora/Outlook style e-mail reader

Mail>Pine

Even if you don't like its e-mail reader interface, it comes with a very easy to use editor

Shells>Bash

Most users like bash

WWW>Lynx

For a command line web browser for quick searches without the overhead of graphics

WWW>Netscape

To see all the pretty graphics on the WWW

Net>Ethereal

Very good packet analyzer that I build for the root user

Once you've built your packages, use Ctrl-Alt-F9 to return to the Window Manager. Only root can build packages, but any user can customize his or her own desktop by adding a pre-built application to the desired menu screen.

As an example, let's add Gimp:

Click on the desired menu's arrow, and click on the Add icon. In the Command Line: section, use the browse button to find the application. If it is not listed in /usr/X11R6/bin, it is probably in /usr/local/bin. Click on the button that has /usr/X11R6/bin, and choose /usr. In the directories screen, double-click on local, then double-click on bin. If you still can't find the file, open up an xterm and try:

whereis applicationname

Gimp is located in /usr/X11R6/bin, so locate it in the files section and double-click. Now browse for an icon. Gimp has its own; if you don't like it, try another one. Finally, type in the Label: section the text you want to appear in your menu screen. Click OK and you are done.

Gimp will now appear as a menu option. If you click on it, you should see Gimp load for the first time. Press continue as you are prompted to accept the defaults.

You may find yourself spending inordinate amounts of time building packages and adding and deleting items from your menus as you become more comfortable with customizing your desktop.

The last customization we'll discuss is wallpaper. The second menu from the right has an option labeled "Backdrop." Click Backdrop, then Browse. You'll see that XFCE comes with quite a few built-in wallpapers. If you select one that sounds interesting, you'll see a preview; if you like it, press Apply.

If you're like me, you accumulate your own collection of backgrounds. In your home directory, make a directory to store your images:

cd /usr/home/username
mkdir pictures

If you find an interesting image on the Web while using Netscape, right-click on the image, choose Save This Image As, and save it to your pictures directory. To turn it into wallpaper, open up your Backdrop menu option and browse to your pictures directory to locate the image.

These tips should get you started on personalizing XFCE.

Now that we have Internet connectivity, an XServer, and a decent looking Window Manager, let's start looking at the power of FreeBSD. The next three articles will focus on accessing local and remote filesystems.

Dru Lavigne is a network and systems administrator, IT instructor, author and international speaker. She has over a decade of experience administering and teaching Netware, Microsoft, Cisco, Checkpoint, SCO, Solaris, Linux, and BSD systems. A prolific author, she pens the popular FreeBSD Basics column for O'Reilly and is author of BSD Hacks and The Best of FreeBSD Basics.


Read more FreeBSD Basics columns.

Discuss this article in the Operating Systems Forum.

Return to the BSD DevCenter.

 

Copyright © 2009 O'Reilly Media, Inc.