Skip to content

Duplicate Home bookmark when pressing Ctrl+D multiple times #3803

Description

@sporteka2

Summary

Pressing Ctrl+D to bookmark the Home folder multiple times creates duplicate entries in ~/.config/gtk-3.0/bookmarks.

Steps to reproduce

  1. Open Nemo and navigate to your home directory (/home/$USER)
  2. Press Ctrl+D (Add Bookmark)
  3. Press Ctrl+D again
  4. Open ~/.config/gtk-3.0/bookmarks — you will see multiple lines for the same location

Example file content:

file:///home/r Home
file:///home/r Home
file:///home/r Home
file:///home/r r

Root cause

The duplicate check in nemo_bookmark_list_contains() (src/nemo-bookmark-list.c:421-424) uses nemo_bookmark_compare_with(), which compares both the URI and the display name.

When a bookmark is first created by nemo_window_add_bookmark_for_current_location(), its initial name is the basename of the path (e.g. "r" for /home/r). Shortly after, bookmark_set_name_from_ready_file() asynchronously renames it to "Home" because nemo_file_is_home() returns TRUE.

On the next Ctrl+D:

  • The existing bookmark has name "Home"
  • The new bookmark has name "r" (not yet renamed)
  • nemo_bookmark_compare_with() sees "r""Home" → reports not duplicate
  • A second entry is appended

Proposed fix

In src/nemo-bookmark-list.c:423, change:

g_list_find_custom (bookmarks->list, (gpointer) bookmark, nemo_bookmark_compare_with)

to:

g_list_find_custom (bookmarks->list, (gpointer) bookmark, nemo_bookmark_compare_uris)

The function nemo_bookmark_compare_uris() already exists in libnemo-private/nemo-bookmark.c and compares only the URI. Bookmark identity should be based on location, not label.

Version

Nemo 6.6.3 (source 6.0.2 contains the same logic)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions