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

Add default titles, to mimic original behavior

Have the modules set their own titles
If no title is specified, use this title, rather than default to name
This commit is contained in:
Sean Smith 2019-04-30 23:29:18 -04:00
parent 3a96c303a8
commit 14abd422b2
53 changed files with 104 additions and 99 deletions

View File

@ -61,7 +61,7 @@ type Common struct {
focusChar int
}
func NewCommonSettingsFromModule(name string, moduleConfig *config.Config, globalSettings *config.Config) *Common {
func NewCommonSettingsFromModule(name, defaultTitle string, moduleConfig *config.Config, globalSettings *config.Config) *Common {
colorsConfig, _ := globalSettings.Get("wtf.colors")
positionPath := "position"
sigilsPath := "wtf.sigils"
@ -93,7 +93,7 @@ func NewCommonSettingsFromModule(name string, moduleConfig *config.Config, globa
Enabled: moduleConfig.UBool("enabled", false),
RefreshInterval: moduleConfig.UInt("refreshInterval", 300),
Title: moduleConfig.UString("title", name),
Title: moduleConfig.UString("title", defaultTitle),
Config: moduleConfig,
focusChar: moduleConfig.UInt("focusChar", -1),

View File

@ -59,7 +59,7 @@ func (widget *Widget) Refresh() {
logLines := widget.tailFile()
widget.app.QueueUpdateDraw(func() {
widget.View.SetTitle(widget.Name())
widget.View.SetTitle(widget.CommonSettings.Title)
widget.View.SetText(widget.contentFrom(logLines))
})
}

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "logger"
const defaultTitle = "Logger"
type Settings struct {
common *cfg.Common
@ -13,7 +13,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "bamboohr"
const defaultTitle = "BambooHR"
type Settings struct {
common *cfg.Common
@ -19,7 +19,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_BAMBOO_HR_TOKEN")),
subdomain: ymlConfig.UString("subdomain", os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN")),

View File

@ -5,13 +5,15 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Bargraph"
type Settings struct {
common *cfg.Common
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "circleci"
const defaultTitle = "CircleCI"
type Settings struct {
common *cfg.Common
@ -18,7 +18,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_CIRCLE_API_KEY")),
}

View File

@ -6,7 +6,7 @@ import (
"github.com/wtfutil/wtf/wtf"
)
const configKey = "clocks"
const defaultTitle = "Clocks"
type colors struct {
rows struct {
@ -28,7 +28,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
dateFormat: ymlConfig.UString("dateFormat", wtf.SimpleDateFormat),
timeFormat: ymlConfig.UString("timeFormat", wtf.SimpleTimeFormat),

View File

@ -6,7 +6,7 @@ import (
"github.com/wtfutil/wtf/wtf"
)
const configKey = "cmdrunner"
const defaultTitle = "CmdRunner"
type Settings struct {
common *cfg.Common
@ -18,7 +18,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, moduleConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, moduleConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, moduleConfig, globalConfig),
args: wtf.ToStrs(moduleConfig.UList("args")),
cmd: moduleConfig.UString("cmd"),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "bittrex"
const defaultTitle = "Bittrex"
type colors struct {
base struct {
@ -37,7 +37,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
settings.colors.base.name = ymlConfig.UString("colors.base.name")

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "blockfolio"
const defaultTitle = "Blockfolio"
type colors struct {
name string
@ -24,7 +24,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
deviceToken: ymlConfig.UString("device_token"),
displayHoldings: ymlConfig.UBool("displayHoldings", true),

View File

@ -42,7 +42,7 @@ func (widget *Widget) Refresh() {
content := widget.contentFrom(positions)
widget.app.QueueUpdateDraw(func() {
widget.View.SetTitle(" Blockfolio ")
widget.View.SetTitle(widget.CommonSettings.Title)
widget.View.SetText(content)
})
}

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "cryptolive"
const defaultTitle = "CryptoLive"
type colors struct {
from struct {
@ -43,7 +43,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
settings.colors.from.name = ymlConfig.UString("colors.from.name")

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/modules/cryptoexchanges/cryptolive/toplist"
)
const configKey = "cryptolive"
const defaultTitle = "CryptolLive"
type colors struct {
from struct {
@ -48,7 +48,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
top, _ := ymlConfig.Map("top")
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
currencies: currencies,
top: top,

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "cryptolive"
const defaultTitle = "CryptoLive"
type colors struct {
from struct {
@ -45,7 +45,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
settings.colors.from.name = ymlConfig.UString("colors.from.name")

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "datadog"
const defaultTitle = "DataDog"
type Settings struct {
common *cfg.Common
@ -20,7 +20,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_DATADOG_API_KEY")),
applicationKey: ymlConfig.UString("applicationKey", os.Getenv("WTF_DATADOG_APPLICATION_KEY")),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "gcal"
const defaultTitle = "Calendar"
type colors struct {
day string
@ -35,7 +35,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
conflictIcon: ymlConfig.UString("conflictIcon", "🚨"),
currentIcon: ymlConfig.UString("currentIcon", "🔸"),

View File

@ -14,7 +14,7 @@ type colors struct {
}
}
const configKey = "gerrit"
const defaultTitle = "Gerrit"
type Settings struct {
colors
@ -30,7 +30,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
domain: ymlConfig.UString("domain", ""),
password: ymlConfig.UString("password", os.Getenv("WTF_GERRIT_PASSWORD")),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "git"
const defaultTitle = "Git"
type Settings struct {
common *cfg.Common
@ -19,7 +19,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
commitCount: ymlConfig.UInt("commitCount", 10),
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]%h [white]%s [grey]%an on %cd[white]"),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "github"
const defaultTitle = "GitHub"
type Settings struct {
common *cfg.Common
@ -23,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_GITHUB_TOKEN")),
baseURL: ymlConfig.UString("baseURL", os.Getenv("WTF_GITHUB_BASE_URL")),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "gitlab"
const defaultTitle = "GitLab"
type Settings struct {
common *cfg.Common
@ -21,7 +21,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_GITLAB_TOKEN")),
domain: ymlConfig.UString("domain"),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "gitter"
const defaultTitle = "Gitter"
type Settings struct {
common *cfg.Common
@ -20,7 +20,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_GITTER_API_TOKEN")),
numberOfMessages: ymlConfig.UInt("numberOfMessages", 10),

View File

@ -59,6 +59,7 @@ func (widget *Widget) Refresh() {
room, err := GetRoom(widget.settings.roomURI, widget.settings.apiToken)
if err != nil {
widget.View.SetWrap(true)
widget.View.SetTitle(widget.CommonSettings.Title)
widget.View.SetText(err.Error())
return
}
@ -73,6 +74,7 @@ func (widget *Widget) Refresh() {
widget.View.SetWrap(true)
widget.app.QueueUpdateDraw(func() {
widget.View.SetTitle(widget.CommonSettings.Title)
widget.View.SetText(err.Error())
})
} else {

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "gspreadsheets"
const defaultTitle = "Google Spreadsheets"
type colors struct {
values string
@ -24,7 +24,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
cellNames: ymlConfig.UList("cells.names"),
secretFile: ymlConfig.UString("secretFile"),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "hackernews"
const defaultTitle = "HackerNews"
type Settings struct {
common *cfg.Common
@ -17,7 +17,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
numberOfStories: ymlConfig.UInt("numberOfStories", 10),
storyType: ymlConfig.UString("storyType", "top"),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "ipapi"
const defaultTitle = "IP API"
type colors struct {
name string
@ -20,7 +20,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
settings.colors.name = ymlConfig.UString("colors.name", "red")

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "ipinfo"
const defaultTitle = "IPInfo"
type colors struct {
name string
@ -20,7 +20,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
settings.colors.name = ymlConfig.UString("colors.name", "red")

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "jenkins"
const defaultTitle = "Jenkins"
type Settings struct {
common *cfg.Common
@ -23,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_JENKINS_API_KEY")),
jobNameRegex: ymlConfig.UString("jobNameRegex", ".*"),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "jira"
const defaultTitle = "Jira"
type colors struct {
rows struct {
@ -32,7 +32,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_JIRA_API_KEY")),
domain: ymlConfig.UString("domain"),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "mercurial"
const defaultTitle = "Mercurial"
type Settings struct {
common *cfg.Common
@ -18,7 +18,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
commitCount: ymlConfig.UInt("commitCount", 10),
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]{rev}:{phase} [white]{desc|firstline|strip} [grey]{author|person} {date|age}[white]"),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "nbascore"
const defaultTitle = "NBA Score"
type Settings struct {
common *cfg.Common
@ -13,7 +13,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "newrelic"
const defaultTitle = "NewRelic"
type Settings struct {
common *cfg.Common
@ -20,7 +20,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_NEW_RELIC_API_KEY")),
applicationID: ymlConfig.UInt("applicationID"),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "opsgenie"
const defaultTitle = "OpsGenie"
type Settings struct {
common *cfg.Common
@ -21,7 +21,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_OPS_GENIE_API_KEY")),
displayEmpty: ymlConfig.UBool("displayEmpty", true),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "pagerduty"
const defaultTitle = "PagerDuty"
type Settings struct {
common *cfg.Common
@ -21,7 +21,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_PAGERDUTY_API_KEY")),
escalationFilter: ymlConfig.UList("escalationFilter"),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "power"
const defaultTitle = "Power"
type Settings struct {
common *cfg.Common
@ -15,7 +15,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "resourceusage"
const defaultTitle = "ResourceUsage"
type Settings struct {
common *cfg.Common
@ -13,7 +13,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "rollbar"
const defaultTitle = "Rollbar"
type Settings struct {
common *cfg.Common
@ -21,7 +21,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
accessToken: ymlConfig.UString("accessToken"),
activeOnly: ymlConfig.UBool("activeOnly", false),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "security"
const defaultTitle = "Security"
type Settings struct {
common *cfg.Common
@ -13,7 +13,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "spotify"
const defaultTitle = "Spotify"
type Settings struct {
common *cfg.Common
@ -13,7 +13,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "spotifyweb"
const defaultTitle = "Spotify Web"
type Settings struct {
common *cfg.Common
@ -20,7 +20,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
callbackPort: ymlConfig.UString("callbackPort", "8080"),
clientID: ymlConfig.UString("clientID", os.Getenv("SPOTIFY_ID")),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "status"
const defaultTitle = "Status"
type Settings struct {
common *cfg.Common
@ -13,7 +13,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "system"
const defaultTitle = "System"
type Settings struct {
common *cfg.Common
@ -13,7 +13,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "textfile"
const defaultTitle = "Textfile"
type Settings struct {
common *cfg.Common
@ -18,7 +18,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
filePaths: ymlConfig.UList("filePaths"),
format: ymlConfig.UBool("format", false),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "todo"
const defaultTitle = "Todo"
type Settings struct {
common *cfg.Common
@ -16,7 +16,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
filePath: ymlConfig.UString("filename"),
}

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "todoist"
const defaultTitle = "Todoist"
type Settings struct {
common *cfg.Common
@ -19,7 +19,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_TODOIST_TOKEN")),
projects: ymlConfig.UList("projects"),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "travisci"
const defaultTitle = "TravisCI"
type Settings struct {
common *cfg.Common
@ -19,7 +19,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_TRAVIS_API_TOKEN")),
pro: ymlConfig.UBool("pro", false),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "trello"
const defaultTitle = "Trello"
type Settings struct {
common *cfg.Common
@ -22,7 +22,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
accessToken: ymlConfig.UString("accessToken", os.Getenv("WTF_TRELLO_ACCESS_TOKEN")),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_TRELLO_APP_KEY")),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "twitter"
const defaultTitle = "Twitter"
type Settings struct {
common *cfg.Common
@ -20,7 +20,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
bearerToken: ymlConfig.UString("bearerToken", os.Getenv("WTF_TWITTER_BEARER_TOKEN")),
count: ymlConfig.UInt("count", 5),

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "unkown"
const defaultTitle = "Unknown"
type Settings struct {
common *cfg.Common
@ -13,7 +13,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
}
return &settings

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "victorops"
const defaultTitle = "VictorOps"
type Settings struct {
common *cfg.Common
@ -20,7 +20,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiID: ymlConfig.UString("apiID", os.Getenv("WTF_VICTOROPS_API_ID")),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_VICTOROPS_API_KEY")),

View File

@ -44,6 +44,7 @@ func (widget *Widget) Refresh() {
}
teams, err := Fetch(widget.settings.apiID, widget.settings.apiKey)
widget.View.SetTitle(widget.ContextualTitle(widget.CommonSettings.Title))
if err != nil {
widget.View.SetWrap(true)

View File

@ -5,7 +5,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "prettyweather"
const defaultTitle = "Pretty Weather"
type Settings struct {
common *cfg.Common
@ -19,7 +19,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
city: ymlConfig.UString("city", "Barcelona"),
language: ymlConfig.UString("language", "en"),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "weather"
const defaultTitle = "Weather"
type colors struct {
current string
@ -26,7 +26,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_OWM_API_KEY")),
cityIDs: ymlConfig.UList("cityids"),

View File

@ -7,7 +7,7 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const configKey = "zendesk"
const defaultTitle = "Zendesk"
type Settings struct {
common *cfg.Common
@ -21,7 +21,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", os.Getenv("ZENDESK_API")),
status: ymlConfig.UString("status"),