summaryrefslogtreecommitdiff
path: root/statusbar.go
diff options
context:
space:
mode:
Diffstat (limited to 'statusbar.go')
-rw-r--r--statusbar.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/statusbar.go b/statusbar.go
index 607b545..6becd39 100644
--- a/statusbar.go
+++ b/statusbar.go
@@ -19,6 +19,7 @@ type Config struct {
IP IPConfig
Mounts MountConfig
Music MusicConfig
+ Clock ClockConfig
}
type IPConfig struct {
@@ -38,6 +39,11 @@ type MusicConfig struct {
LabelStopped string `toml:"labelstopped"`
}
+type ClockConfig struct {
+ Label string
+ Format string
+}
+
func diskSizes(mounts []string) string {
var b strings.Builder
var statfs syscall.Statfs_t
@@ -112,9 +118,9 @@ func ip(interfaceName string, IPv4Only bool) string {
return b.String()
}
-func clock() string {
+func clock(format string) string {
t := time.Now()
- return t.Format("Monday 2006-01-02 15:04:05")
+ return t.Format(format)
}
func nowPlayingMPD() string {
@@ -186,7 +192,8 @@ func main() {
b.WriteString(diskSizes(config.Mounts.MountPoints))
b.WriteString(" ]")
b.WriteString(config.Separator)
- b.WriteString(clock())
+ b.WriteString(config.Clock.Label)
+ b.WriteString(clock(config.Clock.Format))
fmt.Println(b.String())
time.Sleep(10 * time.Second)
}