Skip to content

Sort contacts by last name #264

Closed

Description

@gpdowney

The problem

The contacts list (in tether-gtk, tether-tui and tether --bt-contacts) sorts favorites first, then everyone else alphabetically by full name. The full name is built as “Given Family” in vcard_name_from_n() (vcard.cpp L60–75), so in practice the list sorts by first name (contacts.cpp L119–124). I’d like to order people by last name. That isn’t possible today because VCard only stores the combined name, and the given and family parts of the N field are thrown away after parsing.

What you would like instead

An option to sort contacts by last name, for example tether --bt-contacts-sort <first|last>, with a matching control in the GUI and TUI settings.

A possible implementation:

Add given and family fields to VCard and fill them from N in parse_vcards().
In ContactStore::search(), keep favorites first, then compare on fold(family) and then fold(given) when sorting by last name. Fall back to fold(name) for cards with no N field (businesses, cards that only have FN).
Optionally, show the name as “Family, Given” when sorting by last name.

Alternatives you tried

Searching by last name works, because search matches any part of the name, the number or the email. That finds one person but doesn’t give a browsable list ordered by last name.

Activity

  1. added
    enhancement
    on Oct 22, 2026
  2. zackb commented on Oct 23, 2026

    @zackb
    Owner

    Thanks for the feedback! The contact list always bothered me but I couldn't put my finger on it. This was it :)

    Merged in #265 and will release in 0.2.41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions