added WM support

This commit is contained in:
echo 2022-11-14 15:18:59 +03:30
parent 9faf3cd4b2
commit 3262f354f7
2 changed files with 7 additions and 6 deletions

View file

@ -13,8 +13,6 @@ func GetGPU() string {
shell, err := cmd.Output() shell, err := cmd.Output()
_ = err _ = err
var bruh string var bruh string
//return strings.Replace(string(shell), "\n", "", -1)
//return string(shell)
for _, line := range strings.Split(strings.TrimSuffix(string(shell), "\n"), "\n") { for _, line := range strings.Split(strings.TrimSuffix(string(shell), "\n"), "\n") {
if strings.Contains(line, "VGA") { if strings.Contains(line, "VGA") {
bruh += line[strings.Index(line, ": ")+2 : strings.Index(line, " (")] 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_free, _ := strconv.Atoi(mem_map["MemFree"])
mem_total, _ := strconv.Atoi(mem_map["MemTotal"]) mem_total, _ := strconv.Atoi(mem_map["MemTotal"])
mem_used := mem_total - mem_free mem_used := mem_total - mem_free
//memory := fmt.Sprintf("%d/%d", mem_used/1024, mem_total/1024)
if used { if used {
return formatmem(mem_used / 1024) return formatmem(mem_used / 1024)
} else { } else {
@ -148,12 +145,14 @@ func formatmem(input int) string {
func GetShell() string { func GetShell() string {
return os.Getenv("SHELL") return os.Getenv("SHELL")
} }
func GetWM() string {
return os.Getenv("XDG_CURRENT_DESKTOP")
}
func getPackages() { func getPackages() {
} }
func getResolution() { func getResolution() {
} }
func getWM() {
}
func getTheme() { func getTheme() {
} }
func getIcons() { func getIcons() {

View file

@ -78,8 +78,10 @@ func handlePrint(action, format string, rest string) {
utils.CutePrint(data.GetMemory(false), format) utils.CutePrint(data.GetMemory(false), format)
case "memoryUsed": case "memoryUsed":
utils.CutePrint(data.GetMemory(true), format) utils.CutePrint(data.GetMemory(true), format)
case "wm":
utils.CutePrint(data.GetWM(), format)
default: default:
print("{UNKNOWN KEYWORD}") print("{UNKNOWN KEYWORD: " + rest + "}")
} }
if action == "infoln" { if action == "infoln" {
utils.CuteNewLine() utils.CuteNewLine()