Enable Transparent Label Text Background On The Xfce Desktop

In Windows and Mac OS X, when an object is sitting on your Desktop, the label will generally be in white text, with no background. Then, when highlighted, the background behind the text will become highlighted with whatever your standard “highlight” color is. This is also true with Linux, for the most part. Both GNOME and KDE use this way of doing things, but not Xfce, for some reason.

Look, for example, at the following screenshot. There are nine items sitting on the Desktop, but although they look like they’ve been selected, none of them have been.



It’s a rather unfortunate way of showing items, as it becomes difficult to see exactly which item is selected, and which are not. See again those same nine icons. The middle icon is selected, but it’s very difficult to see this at a glance.



Fortunately, although there aren’t any readily available “point-and-click” methods to change this behavior, the solution isn’t a difficult one.

First, we’ll open up our Terminal.



Now, we either need to open up a certain configuration file, or create it if it doesn’t already exist. A single command will do either (open the file if it exists, or create it if it doesn’t). The name of the file is .gtkrc-2.0 (notice the “.” at the beginning, meaning the file is hidden). The file should be located in the user’s Home folder. To open or create it, type “sudo nano .gtkrc-2.0″ (without the quotes):



Note: you can substitute a different text editor (such as vim or vi, or a GUI text editor such as Gedit or Mousepad, if you don’t want to use nano).

If the file already exists, you’ll see it in your text editor, otherwise you’ll see a blank document.

Now, simply paste in the following large block of text:

style “xfdesktop-icon-view” {
XfdesktopIconView::label-alpha = 0
XfdesktopIconView::selected-label-alpha = 170

base[NORMAL] = “#cccccc”
base[SELECTED] = “#cccccc”
base[ACTIVE] = “#cccccc”

fg[NORMAL] = “#ffffff”
fg[SELECTED] = “#000000″
fg[ACTIVE] = “#000000″
}
widget_class “*XfdesktopIconView*” style “xfdesktop-icon-view”

What does all that mean?

The first line simply tells Xfce that the following gtkrc attributes should be used in place of the default theme’s icon view style for the Xfce Desktop.



The next two lines describe the transparency of the label, unselected or selected. The value of the transparency may be between 0 and 255 (0 is completely transparent, while 255 is completely opaque).



The next three lines don’t deal directly with the transparency, but could be important, depending upon your theme and background image. They describe the color of the background. NORMAL is for when an item is unselected. SELECTED is for when an item is selected, and the Desktop has focus. ACTIVE is for when the icon is selected, but another application has focus (an item is selected on the Desktop, but you’re using Firefox).



By using the values in the block of text above, your background will be highlighted with a very light gray color. You can choose any other HTML color value, of course.

The next group of attributes describes the font color, again with the same three NORMAL, SELECTED and ACTIVE options. Here is where you may want to experiment, but be careful of conflicts. For instance, it wouldn’t do to have your font be white, while also having a white highlight color!



hen you’re finished, simply save the gtkrc-2.0 file, and the next time you log into your computer (or the next time your Xfce Desktop restarts), your changes will be used.



Notice how easy it is (now) to see which file is highlighted, even against a much busier background than the plain color shown in the first couple snapshots? This might not be the most obvious (or very beginner-friendly) method to get this result, but it definitely works.