lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

[Feature Request] Configurable progress animation

Open wojciech-kulik opened this issue 1 year ago • 8 comments

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:

⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏

wojciech-kulik avatar Mar 25 '24 19:03 wojciech-kulik

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

belyakov-am avatar Mar 25 '24 20:03 belyakov-am

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.

wojciech-kulik avatar Mar 26 '24 11:03 wojciech-kulik

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

belyakov-am avatar Mar 26 '24 11:03 belyakov-am

@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

belyakov-am avatar Mar 26 '24 11:03 belyakov-am

I think is safe to asume that users with

gui:
  nerdFontsVersion: "3" 

prefer cool Unicode glyphs.

hasecilu avatar Mar 26 '24 17:03 hasecilu

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

stefanhaller avatar Mar 26 '24 20:03 stefanhaller

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 :)

wojciech-kulik avatar Mar 27 '24 15:03 wojciech-kulik

I will take a look during the weekend and create a PR

belyakov-am avatar Mar 28 '24 07:03 belyakov-am