How to remove "starred" tab in gnome's nautilus?

5,161

Solution 1

Unfortunately the auto-detection of whether to show the 'Starred' panel based on whether you have any starred items was decided against. I don't know why it is shown even without Tracker being available, though.

Note that the sidebar is actually a single unit provided by Gtk, not an editable collection of random items – but still sufficiently customizable for this purpose.

Option 1: Override the built-in UI description.

  1. Create a location for the overrides:

    mkdir ~/.config/nautilus/ui
    
  2. Extract the resource description of the main window:

    gresource extract /bin/nautilus \
              /org/gnome/nautilus/ui/nautilus-window.ui \
              > ~/.config/nautilus/ui/nautilus-window.ui
    
  3. Edit the properties of the GtkPlacesSidebar object:

    <object class="GtkPlacesSidebar" id="places_sidebar">
      ...
      <property name="show-recent">False</property>
      <property name="show-starred-location">False</property>
      ...
    </object>
    
  4. Set the environment variable to make GLib use this override:

    export G_RESOURCE_OVERLAYS="/org/gnome/nautilus/ui=$HOME/.config/nautilus/ui"
    

    Due to Nautilus being started via D-Bus, you will likely need to set this via ~/.pam_environment

    G_RESOURCE_OVERLAYS DEFAULT="/org/gnome/nautilus/ui=/home/confetti/.config/nautilus/ui"
    

    …or via ~/.config/systemd/user/dbus.service.d/environment.conf:

    [Service]
    Environment="G_RESOURCE_OVERLAYS=/org/gnome/nautilus/ui=/home/confetti/.config/nautilus/ui"
    

Option 2: Recompile Nautilus with this patch applied:

diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 0d1234f15..7a6d567f6 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1347,6 +1347,12 @@ nautilus_window_set_up_sidebar (NautilusWindow *window)
                                         | GTK_PLACES_OPEN_NEW_TAB
                                         | GTK_PLACES_OPEN_NEW_WINDOW));

+    gtk_places_sidebar_set_show_recent (GTK_PLACES_SIDEBAR (window->places_sidebar),
+                                        FALSE);
+
+    gtk_places_sidebar_set_show_starred_location (GTK_PLACES_SIDEBAR (window->places_sidebar),
+                                                  FALSE);
+
     g_signal_connect_swapped (window->places_sidebar, "open-location",
                               G_CALLBACK (open_location_cb), window);
     g_signal_connect (window->places_sidebar, "show-error-message",

Solution 2

To the second part of your question. To remove the "Recent" tab, run this command under your user:

$ gsettings set org.gnome.desktop.privacy remember-recent-files false

Alas, I can't find the similar command for the "Starred" tab.

Share:
5,161

Related videos on Youtube

confetti
Author by

confetti

Just a bunch of colored sparkles, your average special snowflake. Obsessed with bash. Trying to get the autobiographer badge so adding onto this about me, apparently the first line isn't enough to get the badge but there's not much to tell about myself. I'm like a bag of confetti. For a few minutes it's super pretty and fun but shortly after everyone's just gonna step on you.

Updated on September 18, 2022

Comments

  • confetti
    confetti over 1 year

    I have a lot of network drives and a few bookmarks and I don't like having my file manager maximized, so I prefer an interface that's as clean as possible.

    enter image description here

    This Starred tab however blocks this for me. I've never used it before. Under gnome 3.28 it wouldn't even work (nothing would show up even when I "Star" it), haven't tried it now with 3.30 but I simply don't need or want this feature at all.

    How would I go on about removing this entry from the menu?
    And while we're at it: Can I remove the "Recent" one too?

    I've went through every settings of nautilus itself and also went through its dconf-editor folder, couldn't find anything that might help me though.

    I just found this - That explains why it doesn't work for me, as I have indexing disabled, but doesn't suggest any solution or way to get rid of it entirely.

  • confetti
    confetti over 5 years
    I've tried option 1 and did step 4 with the [Service] one (please note that I had no ~/.config/systemd directory, I've created it) but it didn't do anything. Do I have to restart my system?
  • user1686
    user1686 over 5 years
    Yes, in order for dbus-daemon to pick up the new environment variables.
  • confetti
    confetti over 5 years
    Just restarted my system, there are however no changes. Should I try the ~/.pam_environment method or troubleshoot somewhere else?
  • user1686
    user1686 over 5 years
    Perhaps the method is no longer effective with GNOME 3.30. (I use a code patch.)
  • confetti
    confetti over 5 years
    My apologies, I've just now noticed that you've hardcoded confetti as username in it, that's probably why it doesn't work lol. I'll change that and try again.
  • confetti
    confetti over 5 years
    Thank you so much. It's working now exactly as intended. It might sound stupid, but that extra space really makes a difference for me.
  • Tanner Legvold
    Tanner Legvold over 3 years
    When I tried step 2 in option 1 on with GNOME 3.36.3 and Ubuntu 20.04.1 I got Don't know how to handle /bin/nautilus gresource is built without elf support. If any one knows how to address this, it'd be appreciated.