mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
set repo name as window title when loading repo, fix #1691
This commit is contained in:
committed by
Jesse Duffield
parent
ad23bd03a0
commit
555d8bbc96
@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -267,3 +268,20 @@ func GetLazygitPath() string {
|
|||||||
}
|
}
|
||||||
return `"` + filepath.ToSlash(ex) + `"`
|
return `"` + filepath.ToSlash(ex) + `"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UpdateWindowTitle() error {
|
||||||
|
if runtime.GOOS != "windows" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
path, getWdErr := os.Getwd()
|
||||||
|
if getWdErr != nil {
|
||||||
|
return getWdErr
|
||||||
|
}
|
||||||
|
title := fmt.Sprint(filepath.Base(path), " - Lazygit")
|
||||||
|
args := append([]string{"/C", "title"}, strings.Split(title, " ")...)
|
||||||
|
cmd := exec.Command("cmd", args...)
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -683,6 +683,8 @@ func (gui *Gui) loadNewRepo() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oscommands.UpdateWindowTitle()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user