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

set repo name as window title when loading repo, fix #1691

This commit is contained in:
Birger Skogeng Pedersen 2022-01-19 10:42:32 +01:00 committed by Jesse Duffield
parent ad23bd03a0
commit 555d8bbc96
2 changed files with 20 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"sync"
@ -267,3 +268,20 @@ func GetLazygitPath() string {
}
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
}

View File

@ -683,6 +683,8 @@ func (gui *Gui) loadNewRepo() error {
return err
}
oscommands.UpdateWindowTitle()
return nil
}