Skip to content

Shorten Home screen title when needed#309

Open
oroderico wants to merge 1 commit into
Blockstream:masterfrom
oroderico:test-pr274-home-fingerprint-no-jade
Open

Shorten Home screen title when needed#309
oroderico wants to merge 1 commit into
Blockstream:masterfrom
oroderico:test-pr274-home-fingerprint-no-jade

Conversation

@oroderico

Copy link
Copy Markdown
Contributor

Note: opening this now so it is ready for review after the 1.0.41 release, as discussed in #274.

Description

The Home status bar title can be clipped on displays where the full Jade <fingerprint> device name does not fit.

This keeps the full Jade <fingerprint> title when it fits. If it would be clipped, the Home screen falls back to showing only the fingerprint. The full device name remains unchanged elsewhere.

Approach

  • Measure the Home title with GUI_TITLE_FONT.
  • Compare it against the status-bar title column width.
  • Strip only the Jade prefix when the full title would not fit.
  • Keep the change scoped to the Home activity title.

Testing

  • Tested on Waveshare S3 Touch LCD2: the Home title falls back to the fingerprint-only title as intended.
  • git diff --check

Comment thread main/ui/dashboard.c Outdated
{
static const char prefix[] = "Jade ";
// Match the status-bar title column width from make_status_bar().
const int title_width_percent = HOME_SCREEN_DEEP_STATUS_BAR ? 35 : 57;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit uncomfortable with this magic number existing in main/gui.c as well as here. I think you should add a constant for it to main/gui.h and use it in both places.

Comment thread main/ui/dashboard.c Outdated
return device_name;
}

return strncmp(device_name, prefix, sizeof(prefix) - 1) == 0 ? device_name + sizeof(prefix) - 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can hardcode the prefix and use strlen for one-off string constant use like this - the compiler will emit the same code for e.g. strncmp(device_name, "Jade ", strlen("Jade ")) and its shorter. We use the longer form for large if blocks typically.

The ternary operator is a little unclear here, it would be better to add the strncmp condition to the if above and return device_name + strlen("Jade ") unconditionally here, with a comment above like // Remove "Jade " prefix to allow the device ID to be shown.

@oroderico oroderico force-pushed the test-pr274-home-fingerprint-no-jade branch from 7989340 to e15c7f4 Compare July 11, 2026 16:40
@oroderico

Copy link
Copy Markdown
Contributor Author

Updated, thanks!

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.

2 participants