From 3262f354f71526ca3605a8979d21d2365d457e08 Mon Sep 17 00:00:00 2001 From: echo <91651232+exhq@users.noreply.github.com> Date: Mon, 14 Nov 2022 15:18:59 +0330 Subject: [PATCH] added WM support --- data/data.go | 9 ++++----- main.go | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/data/data.go b/data/data.go index 605ad9c..9d1d1e7 100644 --- a/data/data.go +++ b/data/data.go @@ -13,8 +13,6 @@ func GetGPU() string { shell, err := cmd.Output() _ = err var bruh string - //return strings.Replace(string(shell), "\n", "", -1) - //return string(shell) for _, line := range strings.Split(strings.TrimSuffix(string(shell), "\n"), "\n") { if strings.Contains(line, "VGA") { bruh += line[strings.Index(line, ": ")+2 : strings.Index(line, " (")] @@ -85,7 +83,6 @@ func GetMemory(used bool) string { mem_free, _ := strconv.Atoi(mem_map["MemFree"]) mem_total, _ := strconv.Atoi(mem_map["MemTotal"]) mem_used := mem_total - mem_free - //memory := fmt.Sprintf("%d/%d", mem_used/1024, mem_total/1024) if used { return formatmem(mem_used / 1024) } else { @@ -148,12 +145,14 @@ func formatmem(input int) string { func GetShell() string { return os.Getenv("SHELL") } +func GetWM() string { + return os.Getenv("XDG_CURRENT_DESKTOP") +} func getPackages() { } func getResolution() { } -func getWM() { -} + func getTheme() { } func getIcons() { diff --git a/main.go b/main.go index 0e22c54..9d2c629 100644 --- a/main.go +++ b/main.go @@ -78,8 +78,10 @@ func handlePrint(action, format string, rest string) { utils.CutePrint(data.GetMemory(false), format) case "memoryUsed": utils.CutePrint(data.GetMemory(true), format) + case "wm": + utils.CutePrint(data.GetWM(), format) default: - print("{UNKNOWN KEYWORD}") + print("{UNKNOWN KEYWORD: " + rest + "}") } if action == "infoln" { utils.CuteNewLine()