lazygit
lazygit copied to clipboard
[Feature Request] Configurable progress animation
Would you consider adding to the configuration a field to configure frames for the inline animation?
Right now it seems to be:
\|/-
I would like to use:
⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏
Would love to have this kind of loader too
I'm willing to contribute and implement this feature if the maintainers decide if it's reasonable
I think I found the place:) https://github.com/jesseduffield/lazygit/blob/fb675b79f8a4a949294e8cab85ce72fed3883362/pkg/utils/utils.go#L31-L36
Maybe it would be better to replace it with the animation I posted? Looks more modern.
Was looking on this function yesterday, decided not to proceed before code owners approval
I was actually thinking about passing characters as a param that can be configured via user config while keeping the current option as a default for the config
@wojciech-kulik absolutely agree with you regarding more modern look of your proposed option
However, maybe there are some reasons to keep the default option ascii only
I think is safe to asume that users with
gui:
nerdFontsVersion: "3"
prefer cool Unicode glyphs.
I'm all for making things look more modern/slick (like we did with the scrollbars), but one problem with the braille animation is that it is even more subtle than the current ascii animation. That's a problem, because we think the animation might not be attention-grabbing enough (see #3142).
I made other attempts at changing the loader in the past (e.g. here), but @jesseduffield didn't like that, so I dropped it again.
Finally, for those of you who want to experiment with this in the code: just pasting strings into the characters string literal is not going to work because of the bytes-are-not-characters-in-utf-8 problem. You'll have to change it to something like this:
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go
index 053b7ac2f..50ebce3eb 100644
--- a/pkg/utils/utils.go
+++ b/pkg/utils/utils.go
@@ -29,10 +29,10 @@ const LoaderAnimationInterval = 50
// Loader dumps a string to be displayed as a loader
func Loader(now time.Time) string {
- characters := "|/-\\"
+ strings := []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}
milliseconds := now.UnixMilli()
- index := milliseconds / LoaderAnimationInterval % int64(len(characters))
- return characters[index : index+1]
+ index := milliseconds / LoaderAnimationInterval % int64(len(strings))
+ return strings[index]
}
// Min returns the minimum of two integers
I guess, someone familiar with go could create a PR :)? I think the approach to go with the new loader for nerdFontsVersion: "3" sounds reasonable + adding to config an option to set own frames :)
I will take a look during the weekend and create a PR