diff --git a/.DS_Store b/.DS_Store index 0e4324da..f996d77e 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/_site/config.toml b/_site/config.toml index 2787a43e..dac31deb 100644 --- a/_site/config.toml +++ b/_site/config.toml @@ -6,4 +6,4 @@ theme = "hyde-hyde" [params] author = "Chris Cummer" authorimage = "/img/wtf.png" - description = "...is that?" + description = "...is going on?" diff --git a/bamboohr/widget.go b/bamboohr/widget.go index bf60dab1..2ac4f3da 100644 --- a/bamboohr/widget.go +++ b/bamboohr/widget.go @@ -4,9 +4,7 @@ import ( "fmt" "time" - "github.com/gdamore/tcell" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" ) @@ -21,8 +19,6 @@ func NewWidget() *Widget { TextWidget: wtf.NewTextWidget(" ðŸ‘― BambooHR ", "bamboohr"), } - widget.addView() - return &widget } @@ -52,18 +48,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGray) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - view.SetWrap(false) - - widget.View = view -} - func (widget *Widget) contentFrom(items []Item) string { if len(items) == 0 { return fmt.Sprintf("\n\n\n\n\n\n\n\n%s", wtf.CenterText("[grey]no one[white]", 50)) diff --git a/color/colors.go b/color/colors.go new file mode 100644 index 00000000..7d7bea55 --- /dev/null +++ b/color/colors.go @@ -0,0 +1,155 @@ +package color + +import ( + "github.com/gdamore/tcell" +) + +var Colors = map[string]tcell.Color{ + "black": tcell.ColorBlack, + "maroon": tcell.ColorMaroon, + "green": tcell.ColorGreen, + "olive": tcell.ColorOlive, + "navy": tcell.ColorNavy, + "purple": tcell.ColorPurple, + "teal": tcell.ColorTeal, + "silver": tcell.ColorSilver, + "gray": tcell.ColorGray, + "red": tcell.ColorRed, + "lime": tcell.ColorLime, + "yellow": tcell.ColorYellow, + "blue": tcell.ColorBlue, + "fuchsia": tcell.ColorFuchsia, + "aqua": tcell.ColorAqua, + "white": tcell.ColorWhite, + "aliceblue": tcell.ColorAliceBlue, + "antiquewhite": tcell.ColorAntiqueWhite, + "aquamarine": tcell.ColorAquaMarine, + "azure": tcell.ColorAzure, + "beige": tcell.ColorBeige, + "bisque": tcell.ColorBisque, + "blanchedalmond": tcell.ColorBlanchedAlmond, + "blueviolet": tcell.ColorBlueViolet, + "brown": tcell.ColorBrown, + "burlywood": tcell.ColorBurlyWood, + "cadetblue": tcell.ColorCadetBlue, + "chartreuse": tcell.ColorChartreuse, + "chocolate": tcell.ColorChocolate, + "coral": tcell.ColorCoral, + "cornflowerblue": tcell.ColorCornflowerBlue, + "cornsilk": tcell.ColorCornsilk, + "crimson": tcell.ColorCrimson, + "darkblue": tcell.ColorDarkBlue, + "darkcyan": tcell.ColorDarkCyan, + "darkgoldenrod": tcell.ColorDarkGoldenrod, + "darkgray": tcell.ColorDarkGray, + "darkgreen": tcell.ColorDarkGreen, + "darkkhaki": tcell.ColorDarkKhaki, + "darkmagenta": tcell.ColorDarkMagenta, + "darkolivegreen": tcell.ColorDarkOliveGreen, + "darkorange": tcell.ColorDarkOrange, + "darkorchid": tcell.ColorDarkOrchid, + "darkred": tcell.ColorDarkRed, + "darksalmon": tcell.ColorDarkSalmon, + "darkseagreen": tcell.ColorDarkSeaGreen, + "darkslateblue": tcell.ColorDarkSlateBlue, + "darkslategray": tcell.ColorDarkSlateGray, + "darkturquoise": tcell.ColorDarkTurquoise, + "darkviolet": tcell.ColorDarkViolet, + "deeppink": tcell.ColorDeepPink, + "deepskyblue": tcell.ColorDeepSkyBlue, + "dimgray": tcell.ColorDimGray, + "dodgerblue": tcell.ColorDodgerBlue, + "firebrick": tcell.ColorFireBrick, + "floralwhite": tcell.ColorFloralWhite, + "forestgreen": tcell.ColorForestGreen, + "gainsboro": tcell.ColorGainsboro, + "ghostwhite": tcell.ColorGhostWhite, + "gold": tcell.ColorGold, + "goldenrod": tcell.ColorGoldenrod, + "greenyellow": tcell.ColorGreenYellow, + "honeydew": tcell.ColorHoneydew, + "hotpink": tcell.ColorHotPink, + "indianred": tcell.ColorIndianRed, + "indigo": tcell.ColorIndigo, + "ivory": tcell.ColorIvory, + "khaki": tcell.ColorKhaki, + "lavender": tcell.ColorLavender, + "lavenderblush": tcell.ColorLavenderBlush, + "lawngreen": tcell.ColorLawnGreen, + "lemonchiffon": tcell.ColorLemonChiffon, + "lightblue": tcell.ColorLightBlue, + "lightcoral": tcell.ColorLightCoral, + "lightcyan": tcell.ColorLightCyan, + "lightgoldenrodyellow": tcell.ColorLightGoldenrodYellow, + "lightgray": tcell.ColorLightGray, + "lightgreen": tcell.ColorLightGreen, + "lightpink": tcell.ColorLightPink, + "lightsalmon": tcell.ColorLightSalmon, + "lightseagreen": tcell.ColorLightSeaGreen, + "lightskyblue": tcell.ColorLightSkyBlue, + "lightslategray": tcell.ColorLightSlateGray, + "lightsteelblue": tcell.ColorLightSteelBlue, + "lightyellow": tcell.ColorLightYellow, + "limegreen": tcell.ColorLimeGreen, + "linen": tcell.ColorLinen, + "mediumaquamarine": tcell.ColorMediumAquamarine, + "mediumblue": tcell.ColorMediumBlue, + "mediumorchid": tcell.ColorMediumOrchid, + "mediumpurple": tcell.ColorMediumPurple, + "mediumseagreen": tcell.ColorMediumSeaGreen, + "mediumslateblue": tcell.ColorMediumSlateBlue, + "mediumspringgreen": tcell.ColorMediumSpringGreen, + "mediumturquoise": tcell.ColorMediumTurquoise, + "mediumvioletred": tcell.ColorMediumVioletRed, + "midnightblue": tcell.ColorMidnightBlue, + "mintcream": tcell.ColorMintCream, + "mistyrose": tcell.ColorMistyRose, + "moccasin": tcell.ColorMoccasin, + "navajowhite": tcell.ColorNavajoWhite, + "oldlace": tcell.ColorOldLace, + "olivedrab": tcell.ColorOliveDrab, + "orange": tcell.ColorOrange, + "orangered": tcell.ColorOrangeRed, + "orchid": tcell.ColorOrchid, + "palegoldenrod": tcell.ColorPaleGoldenrod, + "palegreen": tcell.ColorPaleGreen, + "paleturquoise": tcell.ColorPaleTurquoise, + "palevioletred": tcell.ColorPaleVioletRed, + "papayawhip": tcell.ColorPapayaWhip, + "peachpuff": tcell.ColorPeachPuff, + "peru": tcell.ColorPeru, + "pink": tcell.ColorPink, + "plum": tcell.ColorPlum, + "powderblue": tcell.ColorPowderBlue, + "rebeccapurple": tcell.ColorRebeccaPurple, + "rosybrown": tcell.ColorRosyBrown, + "royalblue": tcell.ColorRoyalBlue, + "saddlebrown": tcell.ColorSaddleBrown, + "salmon": tcell.ColorSalmon, + "sandybrown": tcell.ColorSandyBrown, + "seagreen": tcell.ColorSeaGreen, + "seashell": tcell.ColorSeashell, + "sienna": tcell.ColorSienna, + "skyblue": tcell.ColorSkyblue, + "slateblue": tcell.ColorSlateBlue, + "slategray": tcell.ColorSlateGray, + "snow": tcell.ColorSnow, + "springgreen": tcell.ColorSpringGreen, + "steelblue": tcell.ColorSteelBlue, + "tan": tcell.ColorTan, + "thistle": tcell.ColorThistle, + "tomato": tcell.ColorTomato, + "turquoise": tcell.ColorTurquoise, + "violet": tcell.ColorViolet, + "wheat": tcell.ColorWheat, + "whitesmoke": tcell.ColorWhiteSmoke, + "yellowgreen": tcell.ColorYellowGreen, +} + +func ColorFor(label string) tcell.Color { + if _, ok := Colors[label]; ok { + return Colors[label] + } else { + return tcell.ColorBlue + } +} diff --git a/gcal/widget.go b/gcal/widget.go index 768bfbe6..e862895c 100644 --- a/gcal/widget.go +++ b/gcal/widget.go @@ -5,9 +5,7 @@ import ( "strings" "time" - "github.com/gdamore/tcell" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" "google.golang.org/api/calendar/v3" ) @@ -23,8 +21,6 @@ func NewWidget() *Widget { TextWidget: wtf.NewTextWidget(" ðŸŋ Calendar ", "gcal"), } - widget.addView() - return &widget } @@ -45,18 +41,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGrey) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - view.SetWrap(false) - - widget.View = view -} - func (widget *Widget) contentFrom(events *calendar.Events) string { if events == nil { return "" diff --git a/git/widget.go b/git/widget.go index 073bf362..3340574c 100644 --- a/git/widget.go +++ b/git/widget.go @@ -6,9 +6,7 @@ import ( "time" "unicode/utf8" - "github.com/gdamore/tcell" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" ) @@ -23,8 +21,6 @@ func NewWidget() *Widget { TextWidget: wtf.NewTextWidget(" Git ", "git"), } - widget.addView() - return &widget } @@ -49,18 +45,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGray) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - view.SetWrap(false) - - widget.View = view -} - func (widget *Widget) contentFrom(data map[string][]string) string { str := " [red]Branch[white]\n" str = str + fmt.Sprintf(" %s", data["branch"][0]) diff --git a/github/widget.go b/github/widget.go index 23a3a06a..8ddd44f7 100644 --- a/github/widget.go +++ b/github/widget.go @@ -4,10 +4,8 @@ import ( "fmt" "time" - "github.com/gdamore/tcell" ghb "github.com/google/go-github/github" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" ) @@ -22,8 +20,6 @@ func NewWidget() *Widget { TextWidget: wtf.NewTextWidget(" Github ", "github"), } - widget.addView() - return &widget } @@ -53,18 +49,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGray) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - view.SetWrap(false) - - widget.View = view -} - func (widget *Widget) prsForReview(prs []*ghb.PullRequest, username string) string { if len(prs) > 0 { str := "" diff --git a/jira/widget.go b/jira/widget.go index 8abe65d1..633393eb 100644 --- a/jira/widget.go +++ b/jira/widget.go @@ -4,9 +4,7 @@ import ( "fmt" "time" - "github.com/gdamore/tcell" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" ) @@ -21,8 +19,6 @@ func NewWidget() *Widget { TextWidget: wtf.NewTextWidget("JIRA", "jira"), } - widget.addView() - return &widget } @@ -58,17 +54,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGray) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - - widget.View = view -} - func (widget *Widget) contentFrom(searchResult *SearchResult) string { str := " [red]Assigned Issues[white]\n" diff --git a/newrelic/widget.go b/newrelic/widget.go index 2a1bce1c..c94e53a2 100644 --- a/newrelic/widget.go +++ b/newrelic/widget.go @@ -4,9 +4,7 @@ import ( "fmt" "time" - "github.com/gdamore/tcell" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" nr "github.com/yfronto/newrelic" ) @@ -22,8 +20,6 @@ func NewWidget() *Widget { TextWidget: wtf.NewTextWidget(" New Relic ", "newrelic"), } - widget.addView() - return &widget } @@ -59,18 +55,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGray) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - view.SetWrap(false) - - widget.View = view -} - func (widget *Widget) contentFrom(deploys []nr.ApplicationDeployment) string { str := fmt.Sprintf( " %s\n", diff --git a/opsgenie/widget.go b/opsgenie/widget.go index 051518bf..1b7f7dd5 100644 --- a/opsgenie/widget.go +++ b/opsgenie/widget.go @@ -5,9 +5,7 @@ import ( "strings" "time" - "github.com/gdamore/tcell" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" ) @@ -22,8 +20,6 @@ func NewWidget() *Widget { TextWidget: wtf.NewTextWidget(" ⏰ OpsGenie ", "opsgenie"), } - widget.addView() - return &widget } @@ -53,18 +49,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGray) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - view.SetWrap(false) - - widget.View = view -} - func (widget *Widget) contentFrom(onCallResponse *OnCallResponse) string { str := "" diff --git a/security/widget.go b/security/widget.go index 69d1fe10..36f2f34b 100644 --- a/security/widget.go +++ b/security/widget.go @@ -4,9 +4,7 @@ import ( "fmt" "time" - "github.com/gdamore/tcell" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" ) @@ -21,8 +19,6 @@ func NewWidget() *Widget { TextWidget: wtf.NewTextWidget(" ðŸĪš Security ", "security"), } - widget.addView() - return &widget } @@ -44,18 +40,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGray) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - view.SetWrap(false) - - widget.View = view -} - func (widget *Widget) contentFrom(data *SecurityData) string { str := " [red]WiFi[white]\n" diff --git a/status/widget.go b/status/widget.go index a526b456..5ba66cf3 100644 --- a/status/widget.go +++ b/status/widget.go @@ -5,9 +5,7 @@ import ( "strings" "time" - "github.com/gdamore/tcell" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" ) @@ -25,8 +23,6 @@ func NewWidget() *Widget { Current: 0, } - widget.addView() - return &widget } @@ -52,18 +48,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGray) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - view.SetWrap(false) - - widget.View = view -} - func (widget *Widget) animation() string { icons := []string{"👍", "ðŸĪœ", "ðŸĪ™", "ðŸĪœ", "ðŸĪ˜", "ðŸĪœ", "✊", "ðŸĪœ", "👌", "ðŸĪœ"} next := icons[widget.Current] diff --git a/weather/widget.go b/weather/widget.go index 107794d8..400d5768 100644 --- a/weather/widget.go +++ b/weather/widget.go @@ -6,9 +6,7 @@ import ( "time" owm "github.com/briandowns/openweathermap" - "github.com/gdamore/tcell" "github.com/olebedev/config" - "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" ) @@ -23,8 +21,6 @@ func NewWidget() *Widget { TextWidget: wtf.NewTextWidget(" Weather ", "weather"), } - widget.addView() - return &widget } @@ -47,18 +43,6 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) addView() { - view := tview.NewTextView() - - view.SetBorder(true) - view.SetBorderColor(tcell.ColorGray) - view.SetDynamicColors(true) - view.SetTitle(widget.Name) - view.SetWrap(false) - - widget.View = view -} - func (widget *Widget) contentFrom(data *owm.CurrentWeatherData) string { if len(data.Weather) == 0 { return " Weather data is unavailable." @@ -138,6 +122,8 @@ func icon(data *owm.CurrentWeatherData) string { icon = "ðŸŒĪ" case "scattered clouds": icon = "☁ïļ" + case "shower rain": + icon = "☔ïļ" case "snow": icon = "❄ïļ" case "sunny": diff --git a/wtf/text_widget.go b/wtf/text_widget.go index f2fceda7..606c04e8 100644 --- a/wtf/text_widget.go +++ b/wtf/text_widget.go @@ -6,6 +6,7 @@ import ( "github.com/olebedev/config" "github.com/rivo/tview" + "github.com/senorprogrammer/wtf/color" ) var Config *config.Config @@ -34,9 +35,23 @@ func NewTextWidget(name string, configKey string) TextWidget { }, } + widget.addView() + return widget } +func (widget *TextWidget) addView() { + view := tview.NewTextView() + + view.SetBorder(true) + view.SetBorderColor(color.ColorFor(Config.UString("wtf.border.normal"))) + view.SetDynamicColors(true) + view.SetTitle(widget.Name) + view.SetWrap(false) + + widget.View = view +} + /* -------------------- Exported Functions -------------------- */ func (widget *TextWidget) Disabled() bool {