1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Add SpinnerConfig

This new config section allows to customize frames and rate of
thespinner
This commit is contained in:
Artem Belyakov
2024-04-06 13:35:50 +02:00
committed by Stefan Haller
parent 53f0c4aeff
commit f3dba743f0
15 changed files with 101 additions and 31 deletions

View File

@ -6,7 +6,6 @@ import (
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/status"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
)
type AppStatusHelper struct {
@ -88,16 +87,16 @@ func (self *AppStatusHelper) HasStatus() bool {
}
func (self *AppStatusHelper) GetStatusString() string {
appStatus, _ := self.statusMgr().GetStatusString()
appStatus, _ := self.statusMgr().GetStatusString(self.c.UserConfig)
return appStatus
}
func (self *AppStatusHelper) renderAppStatus() {
self.c.OnWorker(func(_ gocui.Task) {
ticker := time.NewTicker(time.Millisecond * utils.LoaderAnimationInterval)
ticker := time.NewTicker(time.Millisecond * time.Duration(self.c.UserConfig.Gui.Spinner.Rate))
defer ticker.Stop()
for range ticker.C {
appStatus, color := self.statusMgr().GetStatusString()
appStatus, color := self.statusMgr().GetStatusString(self.c.UserConfig)
self.c.Views().AppStatus.FgColor = color
self.c.OnUIThread(func() error {
self.c.SetViewContent(self.c.Views().AppStatus, appStatus)
@ -130,7 +129,7 @@ func (self *AppStatusHelper) renderAppStatusSync(stop chan struct{}) {
for {
select {
case <-ticker.C:
appStatus, color := self.statusMgr().GetStatusString()
appStatus, color := self.statusMgr().GetStatusString(self.c.UserConfig)
self.c.Views().AppStatus.FgColor = color
self.c.SetViewContent(self.c.Views().AppStatus, appStatus)
// Redraw all views of the bottom line: