Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
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 Answers 3

  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;
}
share|improve this answer
1  
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 Shah Sep 7 '12 at 3: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? –  WarriorIng64 Sep 7 '12 at 11:21

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.

share|improve this answer
    
I have also searched a lot and it appears that there is no custom class for "browsing area" inside nautilus.css. –  IgnitE Sep 7 '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

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.

share|improve this answer
3  
The OP wants to use an image, and is trying to achieve this directly from the GTK+3 theme. –  WarriorIng64 Sep 6 '12 at 20:31
    
Editing the base color changes other elements too. –  user43787 Mar 26 '13 at 16:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.