1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

WTF-504 Improve the default config

This commit is contained in:
Chris Cummer 2019-07-22 22:54:01 -07:00
parent 7a70ed75be
commit 0bc6965681
3 changed files with 66 additions and 28 deletions

View File

@ -1,17 +1,36 @@
package cfg package cfg
const defaultConfigFile = `wtf: const defaultConfigFile = `
wtf:
colors: colors:
border: border:
focusable: darkslateblue focusable: darkslateblue
focused: orange focused: orange
normal: gray normal: gray
grid: grid:
columns: [40, 40] columns: [32, 32, 32, 32]
rows: [13, 13, 4] rows: [10, 10, 10, 4, 4]
refreshInterval: 1 refreshInterval: 1
mods: 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: colors:
rows: rows:
even: "lightblue" even: "lightblue"
@ -21,46 +40,66 @@ const defaultConfigFile = `wtf:
Avignon: "Europe/Paris" Avignon: "Europe/Paris"
Barcelona: "Europe/Madrid" Barcelona: "Europe/Madrid"
Dubai: "Asia/Dubai" Dubai: "Asia/Dubai"
Vancouver: "America/Vancouver"
Toronto: "America/Toronto"
position: position:
top: 0 top: 0
left: 0 left: 2
height: 1 height: 1
width: 1 width: 1
refreshInterval: 15 refreshInterval: 15
sort: "alphabetical" sort: "alphabetical"
security: title: "Clocks B"
type: "clocks"
feedreader:
enabled: true enabled: true
feeds:
- http://wtfutil.com/blog/index.xml
feedLimit: 10
position: position:
top: 1 top: 1
left: 0 left: 1
width: 2
height: 1 height: 1
width: 1 updateInterval: 14400
refreshInterval: 3600 ipinfo:
status: colors:
name: "lightblue"
value: "white"
enabled: true enabled: true
position: position:
top: 2 top: 2
left: 0
height: 1
width: 2
refreshInterval: 1
system:
enabled: true
position:
top: 0
left: 1 left: 1
height: 1 height: 1
width: 1 width: 1
refreshInterval: 3600 refreshInterval: 150
power:
enabled: true
position:
top: 2
left: 2
height: 1
width: 1
refreshInterval: 15
title: "⚡️"
textfile: textfile:
enabled: true enabled: true
filePath: "~/.config/wtf/config.yml" filePath: "~/.config/wtf/config.yml"
format: true
position: position:
top: 1 top: 0
left: 1 left: 0
height: 1 height: 4
width: 1 width: 1
refreshInterval: 30 refreshInterval: 30
wrapText: false
uptime:
args: [""]
cmd: "uptime"
enabled: true
position:
top: 3
left: 1
height: 1
width: 2
refreshInterval: 30
type: cmdrunner
` `

View File

@ -12,6 +12,7 @@ import (
"time" "time"
"github.com/gdamore/tcell" "github.com/gdamore/tcell"
"github.com/logrusorgru/aurora"
"github.com/olebedev/config" "github.com/olebedev/config"
"github.com/pkg/profile" "github.com/pkg/profile"
"github.com/radovskyb/watcher" "github.com/radovskyb/watcher"
@ -84,7 +85,7 @@ func setTerm(config *config.Config) {
term := config.UString("wtf.term", os.Getenv("TERM")) term := config.UString("wtf.term", os.Getenv("TERM"))
err := os.Setenv("TERM", term) err := os.Setenv("TERM", term)
if err != nil { 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) os.Exit(1)
} }
} }
@ -173,7 +174,7 @@ func main() {
go watchForConfigChanges(app, flags.Config, flags.HasCustomConfig(), display.Grid, pages) go watchForConfigChanges(app, flags.Config, flags.HasCustomConfig(), display.Grid, pages)
if err := app.SetRoot(pages, true).Run(); err != nil { 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) os.Exit(1)
} }
} }

View File

@ -120,8 +120,6 @@ func (widget *Widget) formattedText() string {
func (widget *Widget) plainText() string { func (widget *Widget) plainText() string {
filePath, _ := utils.ExpandHomeDir(widget.CurrentSource()) filePath, _ := utils.ExpandHomeDir(widget.CurrentSource())
fmt.Println(filePath)
text, err := ioutil.ReadFile(filePath) text, err := ioutil.ReadFile(filePath)
if err != nil { if err != nil {
return err.Error() return err.Error()