summaryrefslogtreecommitdiff
path: root/main.go
blob: 459cb8e1178df9ea779dcdf551a44ca7fd890e20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main

/*
	Author: Jackson Taylor
	Date: 3/28/2020
	Description: This is Jackson's Awesome Status Bar for suckless', very nice, dwm.
*/

import (
	"fmt"
	"os/exec"
	"time"
)

// Module is the interface for you to extend what your bar does.
type Module interface {
	GetInfo() (string, error)
}

// Modules that are displayed in the bar
var BarModules = []Module{
	DateModule{},
	BatteryModule{},
}

func main() {
	main := Bar{
		Modules:     BarModules,
		RefreshRate: time.Second * 1,
	}
	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
}