summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Taylor <jtaylormuffins@gmail.com>2020-04-12 14:32:53 -0400
committerJackson Taylor <jtaylormuffins@gmail.com>2020-04-12 14:32:53 -0400
commitbd8fd546b32193cf50f276079bc9f5dbbb3c7fbf (patch)
tree08ad237d4d5de8dd348bb946eab6b57ef40315a0
parent123bb9ad397d901484ac1841666a2b962cbc211f (diff)
Change bar output to stdout with Println
Plan to impelement direct X11 integration later
-rw-r--r--bar.go12
-rw-r--r--main.go18
2 files changed, 11 insertions, 19 deletions
diff --git a/bar.go b/bar.go
index 159de50..510d292 100644
--- a/bar.go
+++ b/bar.go
@@ -1,18 +1,22 @@
package main
-import "time"
+import "fmt"
// Bar is the struct that holds each of the modules and displays the data from them
type Bar struct {
- Modules []Module
- RefreshRate time.Duration
+ Modules []Module
}
func (b Bar) Display() string {
var val string
for _, mod := range b.Modules {
- s, _ := mod.GetInfo()
+ s, err := mod.GetInfo()
+
+ // TODO: Handle error differently
+ if err != nil {
+ fmt.Println(err)
+ }
val += "[" + s + "]"
}
diff --git a/main.go b/main.go
index 0674996..37f1bb2 100644
--- a/main.go
+++ b/main.go
@@ -8,8 +8,6 @@ package main
import (
"fmt"
- "os/exec"
- "time"
)
// Module is the interface for you to extend what your bar does.
@@ -26,19 +24,9 @@ var BarModules = []Module{
func main() {
main := Bar{
- Modules: BarModules,
- RefreshRate: time.Second * 1,
+ Modules: BarModules,
}
- fmt.Println("Bar Started")
- for {
- display(main.Display())
- time.Sleep(main.RefreshRate)
- fmt.Println("Updating bar")
- }
-}
-
-func display(value string) (err error) {
- err = exec.Command("xsetroot", "-name", value).Run()
- return err
+ // Display the bar info to stdout
+ fmt.Println(main.Display())
}