From 0bc696568147d333bf7051f18cf1ff3a3bf7683f Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Mon, 22 Jul 2019 22:54:01 -0700 Subject: [PATCH] WTF-504 Improve the default config --- cfg/default_config_file.go | 87 +++++++++++++++++++++++++++----------- main.go | 5 ++- modules/textfile/widget.go | 2 - 3 files changed, 66 insertions(+), 28 deletions(-) diff --git a/cfg/default_config_file.go b/cfg/default_config_file.go index e8a91bb1..98a7bfa9 100644 --- a/cfg/default_config_file.go +++ b/cfg/default_config_file.go @@ -1,17 +1,36 @@ package cfg -const defaultConfigFile = `wtf: +const defaultConfigFile = ` +wtf: colors: border: focusable: darkslateblue focused: orange normal: gray grid: - columns: [40, 40] - rows: [13, 13, 4] + columns: [32, 32, 32, 32] + rows: [10, 10, 10, 4, 4] refreshInterval: 1 mods: - clocks: + clocks_a: + colors: + rows: + even: "lightblue" + odd: "white" + enabled: true + locations: + Vancouver: "America/Vancouver" + Toronto: "America/Toronto" + position: + top: 0 + left: 1 + height: 1 + width: 1 + refreshInterval: 15 + sort: "alphabetical" + title: "Clocks A" + type: "clocks" + clocks_b: colors: rows: even: "lightblue" @@ -21,46 +40,66 @@ const defaultConfigFile = `wtf: Avignon: "Europe/Paris" Barcelona: "Europe/Madrid" Dubai: "Asia/Dubai" - Vancouver: "America/Vancouver" - Toronto: "America/Toronto" position: top: 0 - left: 0 + left: 2 height: 1 width: 1 refreshInterval: 15 sort: "alphabetical" - security: + title: "Clocks B" + type: "clocks" + feedreader: enabled: true + feeds: + - http://wtfutil.com/blog/index.xml + feedLimit: 10 position: top: 1 - left: 0 + left: 1 + width: 2 height: 1 - width: 1 - refreshInterval: 3600 - status: + updateInterval: 14400 + ipinfo: + colors: + name: "lightblue" + value: "white" enabled: true position: top: 2 - left: 0 - height: 1 - width: 2 - refreshInterval: 1 - system: - enabled: true - position: - top: 0 left: 1 height: 1 width: 1 - refreshInterval: 3600 + refreshInterval: 150 + power: + enabled: true + position: + top: 2 + left: 2 + height: 1 + width: 1 + refreshInterval: 15 + title: "⚡️" textfile: enabled: true filePath: "~/.config/wtf/config.yml" + format: true position: - top: 1 - left: 1 - height: 1 + top: 0 + left: 0 + height: 4 width: 1 refreshInterval: 30 + wrapText: false + uptime: + args: [""] + cmd: "uptime" + enabled: true + position: + top: 3 + left: 1 + height: 1 + width: 2 + refreshInterval: 30 + type: cmdrunner ` diff --git a/main.go b/main.go index cc97a00d..df46e8cd 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,7 @@ import ( "time" "github.com/gdamore/tcell" + "github.com/logrusorgru/aurora" "github.com/olebedev/config" "github.com/pkg/profile" "github.com/radovskyb/watcher" @@ -84,7 +85,7 @@ func setTerm(config *config.Config) { term := config.UString("wtf.term", os.Getenv("TERM")) err := os.Setenv("TERM", term) if err != nil { - fmt.Printf("\n\033[0;31mERROR:\033[0m Failed to set $TERM to '\033[0;33m%s\033[0m'.\n", term) + fmt.Printf("\n%s Failed to set $TERM to %s.\n", aurora.Red("ERROR"), aurora.Yellow(term)) os.Exit(1) } } @@ -173,7 +174,7 @@ func main() { go watchForConfigChanges(app, flags.Config, flags.HasCustomConfig(), display.Grid, pages) if err := app.SetRoot(pages, true).Run(); err != nil { - fmt.Printf("Error: %v\n", err) + fmt.Printf("\n%s %v\n", aurora.Red("ERROR"), err) os.Exit(1) } } diff --git a/modules/textfile/widget.go b/modules/textfile/widget.go index 604c2ff2..558a10a5 100644 --- a/modules/textfile/widget.go +++ b/modules/textfile/widget.go @@ -120,8 +120,6 @@ func (widget *Widget) formattedText() string { func (widget *Widget) plainText() string { filePath, _ := utils.ExpandHomeDir(widget.CurrentSource()) - fmt.Println(filePath) - text, err := ioutil.ReadFile(filePath) if err != nil { return err.Error()