Skip to content

Draw progress bar in statusline - #1318

Merged
flyingmutant merged 1 commit into
cmus:masterfrom
gavtroy:progress-bar
Sep 14, 2024
Merged

flyingmutant merged 1 commit into
cmus:masterfrom
gavtroy:progress-bar

Conversation

@gavtroy

@gavtroy gavtroy commented Feb 29, 2024

Copy link
Copy Markdown
Collaborator

No description provided.

@pgaskin

pgaskin commented Feb 29, 2024

Copy link
Copy Markdown
Member

It might look better to have the progress bar shown using a slightly different background color instead of as a character.

@gavtroy

gavtroy commented Mar 1, 2024 •

Copy link
Copy Markdown
Collaborator Author

That was my thought too. I started by playing around with using the entire status bar and just changing background color, but I made the mistake of just using the titlebar color and finding the contrast was either much too distracting (e.g. default theme) or that there was no background color at all (e.g. amazon theme). I switched gears at that point and found I really liked the simplicity of a thin line, but the first idea could be workable if we added a new color_statusline_bar_bg and set it for each theme to just a "slightly different" color as you say.

I was able to ctrl-z back to that experiment and push a branch gavtroy:color-progress-bar if you want to get a feel for it.

Edit: and updated that branch now to include a third option of highlighting only around the current position.

@gavtroy
gavtroy force-pushed the progress-bar branch 2 times, most recently from a1acf07 to c52c5e6 Compare March 10, 2024 12:23
@gavtroy
gavtroy force-pushed the progress-bar branch 2 times, most recently from 982117c to 0b6ae7b Compare September 2, 2024 23:34
@gavtroy

gavtroy commented Sep 2, 2024

Copy link
Copy Markdown
Collaborator Author

Changed ────── to ━━━━━━━━ . Also added a non-color "shuttle" option for consistency.

@pgaskin

pgaskin commented Sep 3, 2024 •

Copy link
Copy Markdown
Member

So I tested the different options. The line looks good in all cases (especially now that the line is thicker), but isn't as accurate on narrow screens. The color one looks good in some cases.

I think this is good enough to be merged, but it might be an idea to add a second boolean option to draw the progress bar in the command area, hiding it when text is displayed there. This will reduce the clutter in the status line, while also making it more useful on small displays (and then another PR could be opened to optionally make the command line into a mouse-controlled seekbar).

@pgaskin pgaskin left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good enough as-is, works well, no bugs even when resizing the terminal to various sizes.

Some potential future improvements for other PRs:

  • Another boolean option to display the progress bar in the command line rather than the status line could be nice to have (but it looks fine in the status line especially after the other status line format PR).
  • Some color schemes could have better color selections for the background one, but that can be done later.
  • Mouse support could also be added in another PR later.

@pgaskin

pgaskin commented Sep 9, 2024

Copy link
Copy Markdown
Member

@flyingmutant

1 similar comment
@pgaskin

This comment was marked as duplicate.

Comment thread options.c Outdated
static void toggle_progress_bar(void *data)
{
progress_bar++;
progress_bar %= 5;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Something like NR_PROGRESS_BAR_TYPES would be good to avoid hard-coding 5. Also, cycle (or similar) naming might be more appropriate than toggle.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agree but currently it's only exposed as ":toggle" (or win-toggle/spacebar in the settings screen) and all matching settings use the toggle_* naming. I'm open to adding a :cycle alias but I think it's different from what you were asking.

(And oops, missed the rebase in my first push.)

Styles:
 - line (default)
 - shuttle
 - color
 - color_shuttle
@flyingmutant
flyingmutant merged commit 3af94b7 into cmus:master Sep 14, 2024
@flyingmutant

Copy link
Copy Markdown
Member

Thanks! Merged, let's see what the wider feedback will be.

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.

3 participants