Skip to content

Shorten large unread counters instead of cutting them - #31295

Open
meh7an wants to merge 1 commit into
telegramdesktop:devfrom
meh7an:fix/shortened-unread-badges
Open

meh7an wants to merge 1 commit into
telegramdesktop:devfrom
meh7an:fix/shortened-unread-badges

Conversation

@meh7an

@meh7an meh7an commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Some unread counters cut large counts down to their last digits. The unread badge on the top bar back button, the macOS Dock badge and the window icon counter showed a count of 1,483 as "..83", which doesn't tell how many unread there are.

Other unread badges already shorten counts to thousands instead: the top peers strip and the recent chats in search suggestions, each with its own copy of (count < 1000) ? number : (count / 1000) + 'K'.

Changes

  • FormatUnreadCounterShort() is added to ui/unread_counter_format, next to FormatUnreadCounter(). It keeps that format and adds millions, so counts are shown as 999, 1K, 145K or 1M.
  • The back button badge, the Dock badge, the window icon counter from Window::GenerateCounterLayer(), the top peers strip and the search suggestions all use it.

The tray icon counters, Window::WithSmallCounter() and PlaceCounter() on macOS, have room for about two digits and keep cutting counts from 100 on. The Linux tray also caches its icons based on that format.

Testing

Built and tested on macOS (Debug):

  • With 1,483 unread in the account, the back button badge in the collapsed chat list shows 1K instead of ..83.
  • With 145,037 unread in all accounts, the Dock badge shows 145K instead of ..37.

The window icon counter is drawn only on Windows and was not tested.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant