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
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
`

View File

@ -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)
}
}

View File

@ -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()