add new stats
This commit is contained in:
parent
e8ad780364
commit
01345b0344
30
main.go
30
main.go
@ -7,6 +7,7 @@ import (
|
||||
_ "image/png"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@ -245,6 +246,31 @@ func getAbsLogoPath(relativePath string) string {
|
||||
return relativePath
|
||||
}
|
||||
|
||||
func getShell() string {
|
||||
out, err := exec.Command("ps", "-p", strconv.Itoa(os.Getppid()), "-o", "comm=").Output()
|
||||
if err != nil {
|
||||
return path.Base(os.Getenv("SHELL"))
|
||||
}
|
||||
return strings.TrimSpace(string(out))
|
||||
}
|
||||
|
||||
func getTerminal() string {
|
||||
return os.Getenv("TERM")
|
||||
}
|
||||
|
||||
func getDE() string {
|
||||
return os.Getenv("XDG_CURRENT_DESKTOP")
|
||||
}
|
||||
|
||||
func getUptime() string {
|
||||
out, err := exec.Command("sh", "-c", "uptime -p").Output()
|
||||
if err != nil {
|
||||
return "Unknown"
|
||||
}
|
||||
uptime := strings.TrimPrefix(string(out), "up ")
|
||||
return strings.TrimSpace(uptime)
|
||||
}
|
||||
|
||||
func main() {
|
||||
type Info struct {
|
||||
Label string
|
||||
@ -265,7 +291,11 @@ func main() {
|
||||
{"krnl", getKernel()},
|
||||
{"ram", getRam()},
|
||||
{"gpu", getGpu()},
|
||||
{"de/wm", getDE()},
|
||||
{"pkgs", getPkgs()},
|
||||
{"shell", getShell()},
|
||||
{"term", getTerminal()},
|
||||
{"uptime", getUptime()},
|
||||
}
|
||||
|
||||
logoPath := flag.String("l", absoluteDefaultLogo, "Absolute or relative path to the logo image")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user