Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Full-width labels when no box-art is present #47

Open
vonmillhausen opened this issue Nov 3, 2023 · 2 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@vonmillhausen
Copy link

Personally, I prefer an image-free experience when browsing game lists - I just think it's cleaner. As such, for my Allium install, I purposefully have no box art set up. However, the text labels for games and section/console titles are still horizontally truncated (only stretch across half the screen) even when no box-art is present, and this just wastes space/is ugly.

I did find the hidden "enable_box_art":true option in sd:/.allium/state/stylesheet.json, and I was hoping that when set to false that the text labels might then stretch to the full width of the display... but alas, no.

So I'd like to request a feature whereby if no box-art is present for a selected game/console, or if enable_box_art is set to false, that the text labels on the screen take up the full width.

@vonmillhausen
Copy link
Author

vonmillhausen commented Nov 4, 2023

Just doing a bit of code diving, in case it helps. I think label widths for lists is governed by allium-launcher/src/view/entry_list.rs, lines 63 to 73:

        let list = ScrollList::new(
            Rect::new(
                x + 12,
                y + 8,
                w - IMAGE_WIDTH - 12 - 12 - 24,
                h - 8 - ButtonIcon::diameter(&styles) - 8,
            ),
            Vec::new(),
            Alignment::Left,
            res.get::<Stylesheet>().ui_font.size + SELECTION_MARGIN,
        );

Specifically, the -IMAGE_WIDTH bit. IMAGE_WIDTH is a const defined as 250, so I'm guessing the width of the list's bounding rectangle has the width of the assumed box-art subtracted from it. I suspect that constant is defined before styles.enable_box_art is populated from the stylesheet JSON... so I guess a possible fix here would be something like:

        let boxArtSpacing = if res.get::<Stylesheet>().enable_box_art {IMAGE_WIDTH + 24} else {0};
        let list = ScrollList::new(
            Rect::new(
                x + 12,
                y + 8,
                w - boxArtSpacing - 12 - 12,
                h - 8 - ButtonIcon::diameter(&styles) - 8,
            ),
            Vec::new(),
            Alignment::Left,
            res.get::<Stylesheet>().ui_font.size + SELECTION_MARGIN,
        );

I'm not entirely sure of the purpose of the - 12 - 12 - 24 parts - I'm assuming they're subtracting for margins, so I've included the 24 in the calculation as an example (it isn't clear from the code which numbers relate to which margins, as there are no comments). You may also need to do something with the section of code that follows the above, which sets up the box-art image itself - no point in doing so if enable_box_art is set to false, I guess. Also, I've never used Rust before, so I'm semi-guessing at syntax here being valid. Hope it's helpful!

@goweiwen
Copy link
Owner

This was originally planned, but wasn't implemented in the end, resulting in the enable_box_art remnant.

Thanks for looking into the code, I'll take a look and implement the changes if it's simple. Otherwise, I'm planning to rewrite the entire UI, so this feature might have to wait until then.

@goweiwen goweiwen added enhancement New feature or request good first issue Good for newcomers labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants