Ubuntu – How to reenable alternating grey lines in Nautilus/Files 3.6+ list view

nautilus

I've recently upgraded from Precise to Raring and noticed that Nautilus 3.6, when displaying files and folders in list mode, no longer has alternating grey lines (there's probably a better name for these, but I don't know it; see pictures below). This used to be the default, and helped me to easily distinguish between particular files and their attributes.

Is there a way to reenable this? Is it maybe theme dependent?

The old list view with clearly demarcated lines:
The old list view with clearly demarcated lines:

The new, unclear list view:
The new, unclear list view

Best Answer

The alternate row styling is simply commented out in the Ubuntu default themes.

Editing the theme file

Look for the /gtk-3.0/gtk-widgets.css file within your favorite theme.

  • Custom themes that you installed should be located in ~/.themes (the home folder)
  • The default Ubuntu themes are located in /usr/share/themes/.

Ubuntu 14.04 (Nautilus, Nemo)

Edit the gtk-widgets.css file in your theme folder. So with the Ubuntu default theme for example, that would be /usr/share/themes/Ambiance/gtk-3.0/gtk-widgets.css. Find the following css rule around line ~2224, and add your chosen background color:

view row:nth-child(even){
  /*background-color: @base_color;*/
  background-color: #ECF2FD;  /* <-- add this  */
}   

Ubuntu 13.04

For example, if you are using Ambiance then the file to edit is located at /usr/share/themes/Ambiance/gtk-3.0/gtk-widgets.css.

Uncomment the rules at approx. line 2181, from:

GtkTreeView row:nth-child(odd) {
  /*background-color: shade (@base_color, 0.965);*/
}

To:

GtkTreeView row:nth-child(odd) {
  background-color: shade (@base_color, 0.965);
}

Or use a #RRGGBB colour, the classic OS X light blue colour for example:

GtkTreeView row:nth-child(odd) {
  background-color: #ECF2FD;
}

Editing those rules will work for Nautilus 3.6, as well as Nemo. Nemo, by default, will not show alternating row styles as it will be using the Ubuntu themes.

Note that after editing the file you may have to close and reopen the file browser. If it doesn't work, try relogging. The themes appear to be cached so even if you switch themes with Ubuntu-tweak, it may not display the change immediately.

Using an alternative theme

If you prefer to avoid editing the files you can use an alternative theme. A really nice one is MediterraneanNight Series ("White" and "Night" are the closest to the light/dark themes).

Here's an example with MediterraneanNight White:

MediterraneanWhite Night theme