11

I want to change the background image in the Nautilus file browser. My idea is to put my own style in the background. I'm using Ubuntu 11.10 and Nautilus is version 3.

I know that I have to change the nautilus.css file of the theme, but the problem is that there is not a parameter for the background. I just want to apply an image but I can't find the file or parameter to change it.

The CSS file is in the directory /home/UserName/.theme/MyTheme/gtk-3.0/apps. I've changed the nautilus.css file. I wrote two new lines using CSS style but I don't know where the correct place is to put it. The lines are:

background-image: url("carbon.jpg");
background-repeat: repeat;

Obviously I put the image called carbon.jpg in the same directory of nautilus.css, but this change doesn't work because I need to know whichs class displays the Nautilus file browsing frame. If I find this class I guess that this code will work.

If someone knows how to do it, please tell me because I really want to make this change.

Kesymaru
  • 121
  • 2
    Did you try "/home/UserName/.theme/MyTheme/gtk-3.0/apps/carbon.jpg" as url? or "file:///home/UserName/.theme/MyTheme/gtk-3.0/apps/carbon.jpg"? – Jakob May 16 '12 at 15:06

3 Answers3

8
  1. Open the file /usr/share/themes/MyTheme/gtk-3.0/apps/nautilus.css (Requires root permission).
  2. Add this line:

    NautilusWindow * {background-image:url("bg.jpg");}

    where bg.jpg is the background image you want to display.

  3. Run nautilus -q to kill all open file browsers.

  4. Run nautilus.

This will apply background to all classes present inside NautilusWindow.You can identify the classes where you don't want to apply background and add background-image:none;
Example:

NautilusWindow .sidebar,
NautilusFloatingBar,
NautilusWindow .sidebar .view {
    background-image: none;
}
ignite
  • 8,936
  • 2
    Note that, you don't have to change the file in /usr/share/theme/... location. It is not good. Rather copy the theme from /usr/share/theme and paste it into ~/.themes/ and change there. Also to kill nautilus run nautilus -q. – Anwar Sep 07 '12 at 03:56
  • If you take this approach, then it also applies the background image to the icons for the e.g. forward/backward and search buttons. Is there a way just to theme the file browsing area specifically? – Knowledge Cube Sep 07 '12 at 11:21
3

The part of the theme you want to alter is .view, so in nautilus.css include the following section:

NautilusWindow *.view {
  background-color: @your_predefined_color_here;
}

From my own experimentation on 12.04.1 LTS, I've found that it is possible to define your own background-color property in here with a hexadecimal RGB value, but you cannot set a background-image using -gtk-gradient.

Thus, you probably won't be able to set a background image, but you can at least change the color.

Note: if you don't want this to affect your sidebar, follow the last part of ignite's answer, but use background-color instead of background-image unless you also set that further down in your theme file.


I got the idea to theme .view partially from this Arch Linux forums thread.

  • I have also searched a lot and it appears that there is no custom class for "browsing area" inside nautilus.css. – ignite Sep 07 '12 at 13:43
  • Works, but i had to define NautilusWindow .view and after that NautilusWindow .view:hover, NautilusWindow .view:selected on ubuntu 12.10 if i didn't do that the selection color is not transparent , so i couldn't see the selected items anymore. – user43787 Mar 26 '13 at 16:54
0

If you want just a solid color you open up dconf-editor, go to org > gnome > desktop > interface > gtk color scheme and type base_color:#999999 in the box next to it.

Jorge Castro
  • 71,754
zaiger
  • 9