From 2de364a2ef5c64ca7a221aa2228772f6a0052efd Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Mon, 4 Jun 2018 05:58:37 +0430 Subject: [PATCH 01/17] read widget title from config file --- wtf/text_widget.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wtf/text_widget.go b/wtf/text_widget.go index 17342f0c..8c7f864d 100644 --- a/wtf/text_widget.go +++ b/wtf/text_widget.go @@ -27,7 +27,7 @@ func NewTextWidget(name string, configKey string, focusable bool) TextWidget { enabled: Config.UBool(fmt.Sprintf("wtf.mods.%s.enabled", configKey), false), focusable: focusable, - Name: name, + Name: Config.UString(fmt.Sprintf("wtf.mods.%s.title", configKey), name), RefreshInt: Config.UInt(fmt.Sprintf("wtf.mods.%s.refreshInterval", configKey)), } From e28297407d830d7011ee2d16c3bd17730d24600e Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sun, 3 Jun 2018 20:13:27 -0700 Subject: [PATCH 02/17] Add documentation for CryptoLive --- .../modules/cryptocurrencies/cryptolive.md | 88 ++++++++ _site/content/posts/modules/gcal.md | 2 +- .../hyde-hyde/layouts/partials/sidebar.html | 1 + docs/404.html | 1 + docs/categories/index.html | 1 + docs/index.html | 1 + docs/index.xml | 20 +- .../posts/configuration/attributes/index.html | 1 + docs/posts/configuration/index.html | 1 + docs/posts/configuration/iterm2/index.html | 1 + docs/posts/glossary/index.html | 1 + docs/posts/index.html | 8 + docs/posts/index.xml | 20 +- docs/posts/installation/index.html | 1 + docs/posts/modules/bamboohr/index.html | 1 + docs/posts/modules/clocks/index.html | 1 + docs/posts/modules/cmdrunner/index.html | 1 + .../cryptocurrencies/cryptolive/index.html | 201 ++++++++++++++++++ docs/posts/modules/gcal/index.html | 1 + docs/posts/modules/git/index.html | 1 + docs/posts/modules/github/index.html | 1 + docs/posts/modules/index.html | 1 + docs/posts/modules/ipinfo/index.html | 1 + docs/posts/modules/jira/index.html | 1 + docs/posts/modules/newrelic/index.html | 1 + docs/posts/modules/opsgenie/index.html | 1 + docs/posts/modules/power/index.html | 1 + docs/posts/modules/prettyweather/index.html | 1 + docs/posts/modules/security/index.html | 1 + docs/posts/modules/textfile/index.html | 1 + docs/posts/modules/todo/index.html | 1 + docs/posts/modules/weather/index.html | 1 + docs/posts/overview/index.html | 1 + docs/sitemap.xml | 9 +- docs/tags/index.html | 1 + 35 files changed, 371 insertions(+), 5 deletions(-) create mode 100644 _site/content/posts/modules/cryptocurrencies/cryptolive.md create mode 100644 docs/posts/modules/cryptocurrencies/cryptolive/index.html diff --git a/_site/content/posts/modules/cryptocurrencies/cryptolive.md b/_site/content/posts/modules/cryptocurrencies/cryptolive.md new file mode 100644 index 00000000..7d511c0b --- /dev/null +++ b/_site/content/posts/modules/cryptocurrencies/cryptolive.md @@ -0,0 +1,88 @@ +--- +title: "Cryptolive" +date: 2018-06-03T20:06:40-07:00 +draft: false +--- + +Added in `v0.0.5`. + +Compare crypto currencies using [CryptoCompare](https://cryptocompare.com). + +## Source Code + +```bash +wtf/cryptocurrencies/cryptolive/ +``` + +## Required ENV Vars + +None. + +## Keyboard Commands + +None. + +## Configuration + +```yaml +cryptolive: + colors: + from: + name: coral + displayName: grey + to: + name: white + price: green + currencies: + BTC: + displayName: Bitcoin + to: + - USD + - EUR + - ETH + ETH: + displayName: Ethereum + to: + - USD + - EUR + - ETH + enabled: true + position: + top: 5 + left: 2 + height: 1 + width: 2 + refreshInterval: 30 + updateInterval: 15 +``` + +### Attributes + +`colors.from.name`
+Values: Any X11 +color name. + +`colors.from.dispayName`
+Values: Any X11 +color name. + +`colors.to.name`
+Values: Any X11 +color name. + +`colors.to.price`
+Values: Any X11 +color name. + +`currencies`
+ +`enabled`
+Determines whether or not this module is executed and if its data displayed onscreen.
+Values: `true`, `false`. + +`position`
+Defines where in the grid this module's widget will be displayed.
+ +`refreshInterval`
+How often, in seconds, this module will update its data.
+Values: A positive integer, `0..n`. diff --git a/_site/content/posts/modules/gcal.md b/_site/content/posts/modules/gcal.md index a5774fd3..3376f814 100644 --- a/_site/content/posts/modules/gcal.md +++ b/_site/content/posts/modules/gcal.md @@ -8,7 +8,7 @@ Displays your upcoming Google calendar events. gcal screenshot -**Not:** Setting up access to Google Calendars for Go is a bit unobvious. Check out Google's [Go Quickstart](https://developers.google.com/calendar/quickstart/go) +**Not:** Setting up access to Google Calendars for Go is a bit unobvious. Check out Google's [Go Quickstart](https://developers.google.com/calendar/quickstart/go) first and if you have problems, then take a look at this [comment by WesleydeSouza](https://github.com/senorprogrammer/wtf/issues/83#issuecomment-393665229) which offers a slightly different approach. ## Source Code diff --git a/_site/themes/hyde-hyde/layouts/partials/sidebar.html b/_site/themes/hyde-hyde/layouts/partials/sidebar.html index 8f91fd8e..dbf4b12b 100644 --- a/_site/themes/hyde-hyde/layouts/partials/sidebar.html +++ b/_site/themes/hyde-hyde/layouts/partials/sidebar.html @@ -24,6 +24,7 @@ + diff --git a/docs/404.html b/docs/404.html index 4eed2f2b..1d0472f5 100644 --- a/docs/404.html +++ b/docs/404.html @@ -65,6 +65,7 @@ + diff --git a/docs/categories/index.html b/docs/categories/index.html index 263164e0..5fe1e86c 100644 --- a/docs/categories/index.html +++ b/docs/categories/index.html @@ -67,6 +67,7 @@ + diff --git a/docs/index.html b/docs/index.html index 99ae1e75..ec1f2290 100644 --- a/docs/index.html +++ b/docs/index.html @@ -66,6 +66,7 @@ + diff --git a/docs/index.xml b/docs/index.xml index 2b3ff365..ff336a7b 100644 --- a/docs/index.xml +++ b/docs/index.xml @@ -6,11 +6,29 @@ Recent content on WTF - A Terminal Dashboard Hugo -- gohugo.io en-us - Sat, 02 Jun 2018 05:32:04 -0700 + Sun, 03 Jun 2018 20:06:40 -0700 + + Cryptolive + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + Sun, 03 Jun 2018 20:06:40 -0700 + + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + Added in v0.0.5. +Compare crypto currencies using CryptoCompare. +Source Code wtf/cryptocurrencies/cryptolive/ Required ENV Vars None. +Keyboard Commands None. +Configuration cryptolive:colors:from:name:coraldisplayName:greyto:name:whiteprice:greencurrencies:BTC:displayName:Bitcointo:-USD-EUR-ETHETH:displayName:Ethereumto:-USD-EUR-ETHenabled:trueposition:top:5left:2height:1width:2refreshInterval:30updateInterval:15 Attributes colors.from.name Values: Any X11 color name. +colors.from.dispayName Values: Any X11 color name. +colors.to.name Values: Any X11 color name. +colors.to.price Values: Any X11 color name. +currencies enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module’s widget will be displayed. + + Prettyweather https://wtfutil.com/posts/modules/prettyweather/ diff --git a/docs/posts/configuration/attributes/index.html b/docs/posts/configuration/attributes/index.html index 76a1a2cb..471b05aa 100644 --- a/docs/posts/configuration/attributes/index.html +++ b/docs/posts/configuration/attributes/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/configuration/index.html b/docs/posts/configuration/index.html index ddf6f629..02125fe1 100644 --- a/docs/posts/configuration/index.html +++ b/docs/posts/configuration/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/configuration/iterm2/index.html b/docs/posts/configuration/iterm2/index.html index 5c395343..7490a0a8 100644 --- a/docs/posts/configuration/iterm2/index.html +++ b/docs/posts/configuration/iterm2/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/glossary/index.html b/docs/posts/glossary/index.html index d4533935..14cede16 100644 --- a/docs/posts/glossary/index.html +++ b/docs/posts/glossary/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/index.html b/docs/posts/index.html index 7409e432..c5612a65 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -67,6 +67,7 @@ + @@ -97,6 +98,13 @@

Posts

  • + + Cryptolive + + + + +
  • Prettyweather diff --git a/docs/posts/index.xml b/docs/posts/index.xml index 21b14d1e..89b03cfe 100644 --- a/docs/posts/index.xml +++ b/docs/posts/index.xml @@ -6,11 +6,29 @@ Recent content in Posts on WTF - A Terminal Dashboard Hugo -- gohugo.io en-us - Sat, 02 Jun 2018 05:32:04 -0700 + Sun, 03 Jun 2018 20:06:40 -0700 + + Cryptolive + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + Sun, 03 Jun 2018 20:06:40 -0700 + + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + Added in v0.0.5. +Compare crypto currencies using CryptoCompare. +Source Code wtf/cryptocurrencies/cryptolive/ Required ENV Vars None. +Keyboard Commands None. +Configuration cryptolive:colors:from:name:coraldisplayName:greyto:name:whiteprice:greencurrencies:BTC:displayName:Bitcointo:-USD-EUR-ETHETH:displayName:Ethereumto:-USD-EUR-ETHenabled:trueposition:top:5left:2height:1width:2refreshInterval:30updateInterval:15 Attributes colors.from.name Values: Any X11 color name. +colors.from.dispayName Values: Any X11 color name. +colors.to.name Values: Any X11 color name. +colors.to.price Values: Any X11 color name. +currencies enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module’s widget will be displayed. + + Prettyweather https://wtfutil.com/posts/modules/prettyweather/ diff --git a/docs/posts/installation/index.html b/docs/posts/installation/index.html index 3b10455f..2e247ca7 100644 --- a/docs/posts/installation/index.html +++ b/docs/posts/installation/index.html @@ -65,6 +65,7 @@
  • + diff --git a/docs/posts/modules/bamboohr/index.html b/docs/posts/modules/bamboohr/index.html index 410377b0..060a883a 100644 --- a/docs/posts/modules/bamboohr/index.html +++ b/docs/posts/modules/bamboohr/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/clocks/index.html b/docs/posts/modules/clocks/index.html index acb297d0..fdb2bc05 100644 --- a/docs/posts/modules/clocks/index.html +++ b/docs/posts/modules/clocks/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/cmdrunner/index.html b/docs/posts/modules/cmdrunner/index.html index 22e9ddbf..51243f46 100644 --- a/docs/posts/modules/cmdrunner/index.html +++ b/docs/posts/modules/cmdrunner/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/cryptocurrencies/cryptolive/index.html b/docs/posts/modules/cryptocurrencies/cryptolive/index.html new file mode 100644 index 00000000..cd17c393 --- /dev/null +++ b/docs/posts/modules/cryptocurrencies/cryptolive/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + + + +Cryptolive | WTF - A Terminal Dashboard + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +

    Cryptolive

    + +
    + +
    + + + +

    Added in v0.0.5.

    + +

    Compare crypto currencies using CryptoCompare.

    + +

    Source Code

    +
    wtf/cryptocurrencies/cryptolive/
    +

    Required ENV Vars

    + +

    None.

    + +

    Keyboard Commands

    + +

    None.

    + +

    Configuration

    +
    cryptolive:
    +  colors:
    +    from:
    +      name: coral
    +      displayName: grey
    +    to:
    +      name: white
    +      price: green
    +  currencies:
    +    BTC:
    +      displayName: Bitcoin
    +      to:
    +        - USD
    +        - EUR
    +        - ETH
    +    ETH:
    +      displayName: Ethereum
    +      to:
    +        - USD
    +        - EUR
    +        - ETH
    +  enabled: true
    +  position:
    +    top: 5
    +    left: 2
    +    height: 1
    +    width: 2
    +  refreshInterval: 30
    +  updateInterval: 15
    +

    Attributes

    + +

    colors.from.name
    +Values: Any X11 +color name.

    + +

    colors.from.dispayName
    +Values: Any X11 +color name.

    + +

    colors.to.name
    +Values: Any X11 +color name.

    + +

    colors.to.price
    +Values: Any X11 +color name.

    + +

    currencies

    + +

    enabled
    +Determines whether or not this module is executed and if its data displayed onscreen.
    +Values: true, false.

    + +

    position
    +Defines where in the grid this module’s widget will be displayed.

    + +

    refreshInterval
    +How often, in seconds, this module will update its data.
    +Values: A positive integer, 0..n.

    + +
    + + +
    + + + + diff --git a/docs/posts/modules/gcal/index.html b/docs/posts/modules/gcal/index.html index 6991cc95..06d9687a 100644 --- a/docs/posts/modules/gcal/index.html +++ b/docs/posts/modules/gcal/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/git/index.html b/docs/posts/modules/git/index.html index 5036a5b5..54fbf39d 100644 --- a/docs/posts/modules/git/index.html +++ b/docs/posts/modules/git/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/github/index.html b/docs/posts/modules/github/index.html index 92ccd756..a6af2afb 100644 --- a/docs/posts/modules/github/index.html +++ b/docs/posts/modules/github/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/index.html b/docs/posts/modules/index.html index f6fe6128..0f23575f 100644 --- a/docs/posts/modules/index.html +++ b/docs/posts/modules/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/ipinfo/index.html b/docs/posts/modules/ipinfo/index.html index 82387b46..d8263157 100644 --- a/docs/posts/modules/ipinfo/index.html +++ b/docs/posts/modules/ipinfo/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/jira/index.html b/docs/posts/modules/jira/index.html index de2bb5b5..49a069e2 100644 --- a/docs/posts/modules/jira/index.html +++ b/docs/posts/modules/jira/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/newrelic/index.html b/docs/posts/modules/newrelic/index.html index 95ce89aa..33523eb5 100644 --- a/docs/posts/modules/newrelic/index.html +++ b/docs/posts/modules/newrelic/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/opsgenie/index.html b/docs/posts/modules/opsgenie/index.html index dbecdaba..af21cf3b 100644 --- a/docs/posts/modules/opsgenie/index.html +++ b/docs/posts/modules/opsgenie/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/power/index.html b/docs/posts/modules/power/index.html index d0acf8d0..0a9f05ad 100644 --- a/docs/posts/modules/power/index.html +++ b/docs/posts/modules/power/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/prettyweather/index.html b/docs/posts/modules/prettyweather/index.html index 2502de3e..84169e4d 100644 --- a/docs/posts/modules/prettyweather/index.html +++ b/docs/posts/modules/prettyweather/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/security/index.html b/docs/posts/modules/security/index.html index 371e5197..eaa66c7c 100644 --- a/docs/posts/modules/security/index.html +++ b/docs/posts/modules/security/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/textfile/index.html b/docs/posts/modules/textfile/index.html index e1a0bc26..19d5f84b 100644 --- a/docs/posts/modules/textfile/index.html +++ b/docs/posts/modules/textfile/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/todo/index.html b/docs/posts/modules/todo/index.html index 45c15d11..ae296a70 100644 --- a/docs/posts/modules/todo/index.html +++ b/docs/posts/modules/todo/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/weather/index.html b/docs/posts/modules/weather/index.html index 953f1f37..eeeefa97 100644 --- a/docs/posts/modules/weather/index.html +++ b/docs/posts/modules/weather/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/overview/index.html b/docs/posts/overview/index.html index 3b8c7f0d..d66ec009 100644 --- a/docs/posts/overview/index.html +++ b/docs/posts/overview/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 486fc7eb..38034fc0 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -2,6 +2,11 @@ + + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + 2018-06-03T20:06:40-07:00 + + https://wtfutil.com/posts/modules/prettyweather/ 2018-06-02T05:32:04-07:00 @@ -124,7 +129,7 @@ https://wtfutil.com/posts/ - 2018-06-02T05:32:04-07:00 + 2018-06-03T20:06:40-07:00 0 @@ -135,7 +140,7 @@ https://wtfutil.com/ - 2018-06-02T05:32:04-07:00 + 2018-06-03T20:06:40-07:00 0 diff --git a/docs/tags/index.html b/docs/tags/index.html index 3d782109..5124d493 100644 --- a/docs/tags/index.html +++ b/docs/tags/index.html @@ -67,6 +67,7 @@ + From cc093caa92968b939e79b59e0103385f8b32af00 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sun, 3 Jun 2018 20:22:40 -0700 Subject: [PATCH 03/17] Tweak the formatting of the CryptoLive module a bit --- cryptoexchanges/cryptolive/widget.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cryptoexchanges/cryptolive/widget.go b/cryptoexchanges/cryptolive/widget.go index 4c652104..6750fea4 100644 --- a/cryptoexchanges/cryptolive/widget.go +++ b/cryptoexchanges/cryptolive/widget.go @@ -98,7 +98,7 @@ func display(widget *Widget) { toPriceColor = Config.UString("wtf.mods.cryptolive.colors.to.price", "green") ) for _, item := range widget.list.items { - str += fmt.Sprintf("[%s]%s[%s](%s):\n", fromNameColor, item.displayName, fromDisplayNameColor, item.name) + str += fmt.Sprintf(" [%s]%s[%s] (%s)\n", fromNameColor, item.displayName, fromDisplayNameColor, item.name) for _, toItem := range item.to { str += fmt.Sprintf("\t[%s]%s: [%s]%f\n", toNameColor, toItem.name, toPriceColor, toItem.price) } @@ -116,7 +116,7 @@ func getToList(fromName string) []*toCurrency { for _, to := range toNames { toList = append(toList, &toCurrency{ name: to.(string), - price: -1, + price: 0, }) } From 36e98b02994319a0cb65953de0bfa8e150d0228f Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Tue, 29 May 2018 15:53:45 +0430 Subject: [PATCH 04/17] made cryptolive module --- cryptolive/cryptolive.go | 44 +++++++++++++ cryptolive/widget.go | 133 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 cryptolive/cryptolive.go create mode 100644 cryptolive/widget.go diff --git a/cryptolive/cryptolive.go b/cryptolive/cryptolive.go new file mode 100644 index 00000000..adc99660 --- /dev/null +++ b/cryptolive/cryptolive.go @@ -0,0 +1,44 @@ +package cryptolive + +type list struct { + items []*fromCurrency +} + +type fromCurrency struct { + name string + displayName string + to []*toCurrency +} + +type toCurrency struct { + name string + price float32 +} + +type cResponse struct { + BTC float32 `json:"BTC"` + HBZ float32 `json:"HBZ"` + ETH float32 `json:"ETH"` + EOS float32 `json:"EOS"` + BCH float32 `json:"BCH"` + TRX float32 `json:"TRX"` + XRP float32 `json:"XRP"` + LTC float32 `json:"LTC"` + ETC float32 `json:"ETC"` + ADA float32 `json:"ADA"` + CMT float32 `json:"CMT"` + DASH float32 `json:"DASH"` + ZEC float32 `json:"ZEC"` + IOT float32 `json:"IOT"` + ONT float32 `json:"ONT"` + NEO float32 `json:"NEO"` + BTG float32 `json:"BTG"` + LSK float32 `json:"LSK"` + ELA float32 `json:"ELA"` + DTA float32 `json:"DTA"` + NANO float32 `json:"NANO"` + WTC float32 `json:"WTC"` + DOGE float32 `json:"DOGE"` + USD float32 `json:"USD"` + EUR float32 `json:"EUR"` +} diff --git a/cryptolive/widget.go b/cryptolive/widget.go new file mode 100644 index 00000000..8ddf2408 --- /dev/null +++ b/cryptolive/widget.go @@ -0,0 +1,133 @@ +package cryptolive + +import ( + "fmt" + "time" + + "github.com/cizixs/gohttp" + + "reflect" + + "github.com/olebedev/config" + "github.com/senorprogrammer/wtf/wtf" +) + +// Config is a pointer to the global config object +var Config *config.Config + +var started = false + +// Widget define wtf widget to register widget later +type Widget struct { + wtf.TextWidget + + CurrentIcon int + + *list +} + +// NewWidget Make new instance of widget +func NewWidget() *Widget { + started = false + widget := Widget{ + TextWidget: wtf.NewTextWidget(" $ CryptoLive ", "cryptolive", false), + } + + currenciesMap, _ := Config.Map("wtf.mods.cryptolive.currencies") + + var currencies []*fromCurrency + + for currency := range currenciesMap { + displayName, _ := Config.String("wtf.mods.cryptolive.currencies." + currency + ".displayName") + toCList, _ := Config.List("wtf.mods.cryptolive.currencies." + currency + ".to") + var toList []*toCurrency + for _, v := range toCList { + toList = append(toList, &toCurrency{ + name: v.(string), + price: -1, + }) + } + currencies = append(currencies, &fromCurrency{ + name: currency, + displayName: displayName, + to: toList, + }) + } + + widget.list = &list{ + items: currencies, + } + + return &widget +} + +/* -------------------- Exported Functions -------------------- */ + +// Refresh & update after interval time +func (widget *Widget) Refresh() { + if widget.Disabled() { + return + } + + if started == false { + go func() { + for { + widget.updateCurrencies() + time.Sleep(time.Duration(widget.RefreshInterval()) * time.Second) + } + }() + + } + + started = true + + widget.UpdateRefreshedAt() + widget.View.Clear() + display(widget) +} + +/* -------------------- Unexported Functions -------------------- */ + +func display(widget *Widget) { + str := "" + for _, item := range widget.list.items { + str += fmt.Sprintf("[coral]%s[gray](%s):\n", item.displayName, item.name) + for _, toItem := range item.to { + str += fmt.Sprintf("\t%s[%s]: %f\n", toItem.name, "green", toItem.price) + } + str += "\n" + } + + fmt.Fprintf( + widget.View, + "\n%s", + str, + ) +} + +func (widget *Widget) updateCurrencies() { + defer func() { + recover() + }() + for _, fromCurrency := range widget.list.items { + request := gohttp.New().Path("data", "price").Query("fsym", fromCurrency.name) + tsyms := "" + for _, toCurrency := range fromCurrency.to { + tsyms += fmt.Sprintf("%s,", toCurrency.name) + } + + response, err := request.Query("tsyms", tsyms).Get("https://min-api.cryptocompare.com") + if err != nil { + } + + jsonResponse := &cResponse{} + response.AsJSON(jsonResponse) + + responseRef := reflect.Indirect(reflect.ValueOf(jsonResponse)) + for idx, toCurrency := range fromCurrency.to { + fromCurrency.to[idx].price = responseRef.FieldByName(toCurrency.name).Interface().(float32) + } + + } + +} From 3bd0bda57e04d2fd770b6c0412e2642b10158e16 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Tue, 29 May 2018 20:17:37 +0430 Subject: [PATCH 05/17] add some comments --- cryptolive/widget.go | 4 +--- wtf.go | 11 ++++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cryptolive/widget.go b/cryptolive/widget.go index 8ddf2408..ec6dbea7 100644 --- a/cryptolive/widget.go +++ b/cryptolive/widget.go @@ -2,12 +2,10 @@ package cryptolive import ( "fmt" + "reflect" "time" "github.com/cizixs/gohttp" - - "reflect" - "github.com/olebedev/config" "github.com/senorprogrammer/wtf/wtf" ) diff --git a/wtf.go b/wtf.go index 8a8d38ff..2f3dec4e 100644 --- a/wtf.go +++ b/wtf.go @@ -13,6 +13,7 @@ import ( "github.com/senorprogrammer/wtf/bamboohr" "github.com/senorprogrammer/wtf/clocks" "github.com/senorprogrammer/wtf/cmdrunner" + "github.com/senorprogrammer/wtf/cryptolive" "github.com/senorprogrammer/wtf/gcal" "github.com/senorprogrammer/wtf/git" "github.com/senorprogrammer/wtf/github" @@ -154,9 +155,12 @@ var ( ) func makeWidgets(app *tview.Application, pages *tview.Pages) { + // Always in alphabetical order bamboohr.Config = Config clocks.Config = Config cmdrunner.Config = Config + wtf.Config = Config + cryptolive.Config = Config gcal.Config = Config git.Config = Config github.Config = Config @@ -165,19 +169,20 @@ func makeWidgets(app *tview.Application, pages *tview.Pages) { newrelic.Config = Config opsgenie.Config = Config power.Config = Config + prettyweather.Config = Config security.Config = Config status.Config = Config system.Config = Config textfile.Config = Config todo.Config = Config weather.Config = Config - prettyweather.Config = Config - wtf.Config = Config + // Always in alphabetical order Widgets = []wtf.Wtfable{ bamboohr.NewWidget(), clocks.NewWidget(), cmdrunner.NewWidget(), + cryptolive.NewWidget(), gcal.NewWidget(), git.NewWidget(app, pages), github.NewWidget(app, pages), @@ -186,13 +191,13 @@ func makeWidgets(app *tview.Application, pages *tview.Pages) { newrelic.NewWidget(), opsgenie.NewWidget(), power.NewWidget(), + prettyweather.NewWidget(), security.NewWidget(), status.NewWidget(), system.NewWidget(date, version), textfile.NewWidget(app, pages), todo.NewWidget(app, pages), weather.NewWidget(app, pages), - prettyweather.NewWidget(), } FocusTracker = wtf.FocusTracker{ From 6a35f122a3702d5920283154c4579003ba9a7d77 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Tue, 29 May 2018 20:33:34 +0430 Subject: [PATCH 06/17] add time interval for send http request --- cryptolive/widget.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cryptolive/widget.go b/cryptolive/widget.go index ec6dbea7..09e01985 100644 --- a/cryptolive/widget.go +++ b/cryptolive/widget.go @@ -19,7 +19,8 @@ var started = false type Widget struct { wtf.TextWidget - CurrentIcon int + // time interval for send http request + updateInterval int *list } @@ -28,7 +29,8 @@ type Widget struct { func NewWidget() *Widget { started = false widget := Widget{ - TextWidget: wtf.NewTextWidget(" $ CryptoLive ", "cryptolive", false), + TextWidget: wtf.NewTextWidget(" $ CryptoLive ", "cryptolive", false), + updateInterval: Config.UInt("wtf.mods.cryptolive.updateInterval", 10), } currenciesMap, _ := Config.Map("wtf.mods.cryptolive.currencies") @@ -71,7 +73,7 @@ func (widget *Widget) Refresh() { go func() { for { widget.updateCurrencies() - time.Sleep(time.Duration(widget.RefreshInterval()) * time.Second) + time.Sleep(time.Duration(widget.updateInterval) * time.Second) } }() @@ -127,5 +129,4 @@ func (widget *Widget) updateCurrencies() { } } - } From adbb8eab526d260d65955dbbc5d4a54c3ebcb741 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Sat, 2 Jun 2018 11:38:29 +0430 Subject: [PATCH 07/17] clean up cryptolive --- cryptolive/cryptolive.go | 10 ++++++++++ cryptolive/widget.go | 43 ++++++++++++++++++++++------------------ 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/cryptolive/cryptolive.go b/cryptolive/cryptolive.go index adc99660..462c144e 100644 --- a/cryptolive/cryptolive.go +++ b/cryptolive/cryptolive.go @@ -42,3 +42,13 @@ type cResponse struct { USD float32 `json:"USD"` EUR float32 `json:"EUR"` } + +/* -------------------- Unexported Functions -------------------- */ + +func (l *list) addItem(name string, displayName string, to []*toCurrency) { + l.items = append(l.items, &fromCurrency{ + name: name, + displayName: displayName, + to: to, + }) +} diff --git a/cryptolive/widget.go b/cryptolive/widget.go index 09e01985..0766e63a 100644 --- a/cryptolive/widget.go +++ b/cryptolive/widget.go @@ -33,32 +33,22 @@ func NewWidget() *Widget { updateInterval: Config.UInt("wtf.mods.cryptolive.updateInterval", 10), } + widget.setList() + + return &widget +} + +func (widget *Widget) setList() { currenciesMap, _ := Config.Map("wtf.mods.cryptolive.currencies") - var currencies []*fromCurrency + widget.list = &list{} for currency := range currenciesMap { displayName, _ := Config.String("wtf.mods.cryptolive.currencies." + currency + ".displayName") - toCList, _ := Config.List("wtf.mods.cryptolive.currencies." + currency + ".to") - var toList []*toCurrency - for _, v := range toCList { - toList = append(toList, &toCurrency{ - name: v.(string), - price: -1, - }) - } - currencies = append(currencies, &fromCurrency{ - name: currency, - displayName: displayName, - to: toList, - }) + toList := getToList(currency) + widget.list.addItem(currency, displayName, toList) } - widget.list = &list{ - items: currencies, - } - - return &widget } /* -------------------- Exported Functions -------------------- */ @@ -130,3 +120,18 @@ func (widget *Widget) updateCurrencies() { } } + +func getToList(fromName string) []*toCurrency { + toNames, _ := Config.List("wtf.mods.cryptolive.currencies." + fromName + ".to") + + var toList []*toCurrency + + for _, to := range toNames { + toList = append(toList, &toCurrency{ + name: to.(string), + price: -1, + }) + } + + return toList +} From 16b7cc0bb070ce4c4fc78499dad45fe50c1d6f5e Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Sat, 2 Jun 2018 12:49:56 +0430 Subject: [PATCH 08/17] clean up, handle error, use net/http, read colors from config file --- cryptolive/widget.go | 110 ++++++++++++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 34 deletions(-) diff --git a/cryptolive/widget.go b/cryptolive/widget.go index 0766e63a..e76bd183 100644 --- a/cryptolive/widget.go +++ b/cryptolive/widget.go @@ -1,11 +1,12 @@ package cryptolive import ( + "encoding/json" "fmt" + "net/http" "reflect" "time" - "github.com/cizixs/gohttp" "github.com/olebedev/config" "github.com/senorprogrammer/wtf/wtf" ) @@ -14,6 +15,8 @@ import ( var Config *config.Config var started = false +var baseURL = "https://min-api.cryptocompare.com/data/price" +var ok = true // Widget define wtf widget to register widget later type Widget struct { @@ -60,6 +63,7 @@ func (widget *Widget) Refresh() { } if started == false { + // this code should run once go func() { for { widget.updateCurrencies() @@ -73,6 +77,13 @@ func (widget *Widget) Refresh() { widget.UpdateRefreshedAt() widget.View.Clear() + + if !ok { + widget.View.SetText( + fmt.Sprint("Please check your internet connection!"), + ) + return + } display(widget) } @@ -80,45 +91,21 @@ func (widget *Widget) Refresh() { func display(widget *Widget) { str := "" + var ( + fromNameColor = Config.UString("wtf.mods.cryptolive.colors.from.name", "coral") + fromDisplayNameColor = Config.UString("wtf.mods.cryptolive.colors.from.displayName", "gray") + toNameColor = Config.UString("wtf.mods.cryptolive.colors.to.name", "white") + toPriceColor = Config.UString("wtf.mods.cryptolive.colors.to.price", "green") + ) for _, item := range widget.list.items { - str += fmt.Sprintf("[coral]%s[gray](%s):\n", item.displayName, item.name) + str += fmt.Sprintf("[%s]%s[%s](%s):\n", fromNameColor, item.displayName, fromDisplayNameColor, item.name) for _, toItem := range item.to { - str += fmt.Sprintf("\t%s[%s]: %f\n", toItem.name, "green", toItem.price) + str += fmt.Sprintf("\t[%s]%s: [%s]%f\n", toNameColor, toItem.name, toPriceColor, toItem.price) } str += "\n" } - fmt.Fprintf( - widget.View, - "\n%s", - str, - ) -} - -func (widget *Widget) updateCurrencies() { - defer func() { - recover() - }() - for _, fromCurrency := range widget.list.items { - request := gohttp.New().Path("data", "price").Query("fsym", fromCurrency.name) - tsyms := "" - for _, toCurrency := range fromCurrency.to { - tsyms += fmt.Sprintf("%s,", toCurrency.name) - } - - response, err := request.Query("tsyms", tsyms).Get("https://min-api.cryptocompare.com") - if err != nil { - } - - jsonResponse := &cResponse{} - response.AsJSON(jsonResponse) - - responseRef := reflect.Indirect(reflect.ValueOf(jsonResponse)) - for idx, toCurrency := range fromCurrency.to { - fromCurrency.to[idx].price = responseRef.FieldByName(toCurrency.name).Interface().(float32) - } - - } + widget.View.SetText(fmt.Sprintf("\n%s", str)) } func getToList(fromName string) []*toCurrency { @@ -135,3 +122,58 @@ func getToList(fromName string) []*toCurrency { return toList } + +func (widget *Widget) updateCurrencies() { + defer func() { + recover() + }() + for _, fromCurrency := range widget.list.items { + var ( + client http.Client + jsonResponse cResponse + ) + + client = http.Client{ + Timeout: time.Duration(5 * time.Second), + } + + request := makeRequest(fromCurrency) + response, err := client.Do(request) + + if err != nil { + ok = false + } else { + ok = true + } + + defer response.Body.Close() + + _ = json.NewDecoder(response.Body).Decode(&jsonResponse) + + setPrices(&jsonResponse, fromCurrency) + + } +} + +func makeRequest(currency *fromCurrency) *http.Request { + fsym := currency.name + tsyms := "" + for _, to := range currency.to { + tsyms += fmt.Sprintf("%s,", to.name) + } + + url := fmt.Sprintf("%s?fsym=%s&tsyms=%s", baseURL, fsym, tsyms) + request, err := http.NewRequest("GET", url, nil) + + if err != nil { + } + + return request +} + +func setPrices(response *cResponse, currencry *fromCurrency) { + responseRef := reflect.Indirect(reflect.ValueOf(response)) + for idx, toCurrency := range currencry.to { + currencry.to[idx].price = responseRef.FieldByName(toCurrency.name).Interface().(float32) + } +} From 5ccb0d2b72b3e1e5216bb97d17a8b2b537e82429 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Sat, 2 Jun 2018 13:23:47 +0430 Subject: [PATCH 09/17] fixed display after any update --- cryptolive/widget.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cryptolive/widget.go b/cryptolive/widget.go index e76bd183..ff3602f9 100644 --- a/cryptolive/widget.go +++ b/cryptolive/widget.go @@ -128,6 +128,7 @@ func (widget *Widget) updateCurrencies() { recover() }() for _, fromCurrency := range widget.list.items { + var ( client http.Client jsonResponse cResponse @@ -151,8 +152,9 @@ func (widget *Widget) updateCurrencies() { _ = json.NewDecoder(response.Body).Decode(&jsonResponse) setPrices(&jsonResponse, fromCurrency) - } + + display(widget) } func makeRequest(currency *fromCurrency) *http.Request { From be8cb863567e652f4c6670fa88b20e3a0a2a704f Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Sat, 2 Jun 2018 13:35:50 +0430 Subject: [PATCH 10/17] misspelled grey --- cryptolive/widget.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptolive/widget.go b/cryptolive/widget.go index ff3602f9..bdfc6655 100644 --- a/cryptolive/widget.go +++ b/cryptolive/widget.go @@ -93,7 +93,7 @@ func display(widget *Widget) { str := "" var ( fromNameColor = Config.UString("wtf.mods.cryptolive.colors.from.name", "coral") - fromDisplayNameColor = Config.UString("wtf.mods.cryptolive.colors.from.displayName", "gray") + fromDisplayNameColor = Config.UString("wtf.mods.cryptolive.colors.from.displayName", "grey") toNameColor = Config.UString("wtf.mods.cryptolive.colors.to.name", "white") toPriceColor = Config.UString("wtf.mods.cryptolive.colors.to.price", "green") ) From b71c6c5e5b0f69445f6a1f977b7e8916922bbb76 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Sat, 2 Jun 2018 13:37:21 +0430 Subject: [PATCH 11/17] added cryptolive to docs --- docs/posts/modules/cryptolive/index.html | 243 +++++++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 docs/posts/modules/cryptolive/index.html diff --git a/docs/posts/modules/cryptolive/index.html b/docs/posts/modules/cryptolive/index.html new file mode 100644 index 00000000..63395a42 --- /dev/null +++ b/docs/posts/modules/cryptolive/index.html @@ -0,0 +1,243 @@ + + + + + + + + + + + + + Module: CryptoLive | WTF - A Terminal Dashboard + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +

    Module: CryptoLive

    + +
    + +
    + +

    Compare crypto currencies using cryptocompare.com

    + +

    Source Code

    +
    +
    wtf/cryptolive/
    +
    +

    Required ENV Variables

    + +

    None.

    + +

    Keyboard Commands

    + +

    None.

    + +

    Configuration

    +
    +
    cryptolive:
    +  enabled: true
    +  position:
    +    top: 1
    +    left: 2
    +    height: 1
    +    width: 1
    +  refreshInterval: 15
    +  updateInterval: 15
    +  currencies: 
    +   BTC:
    +     displayName: Bitcoin
    +     to: 
    +       - USD
    +       - EUR
    +       - ETH
    +   ETH:
    +     displayName: Ethereum
    +     to: 
    +       - USD
    +       - EUR
    +       - ETH
    +  colors: 
    +   from: 
    +     name: coral
    +     displayName: grey
    +   to:
    +     name: white
    +     price: green
    +
    +
    +
    +

    Attributes

    + + + +

    + enabled +
    Determines whether or not this module is executed and if its data displayed onscreen. +
    Values: + true, + false.

    + +

    + position +
    Defines where in the grid this module’s widget will be displayed. +
    +

    + +

    + updateInterval +
    How often, in seconds, this module will update its data. +
    Values: A positive integer +
    Default Value: 10

    + +

    + colors +
    Sets color of texts. +
    Values: A valid color +

    + +
    + + +
    + + + + \ No newline at end of file From 985d0869f3874fa688507b6132ca2289243224e7 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Sun, 3 Jun 2018 05:25:25 +0430 Subject: [PATCH 12/17] move cryptolive to cryptoexchanges --- {cryptolive => cryptoexchanges/cryptolive}/cryptolive.go | 0 {cryptolive => cryptoexchanges/cryptolive}/widget.go | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {cryptolive => cryptoexchanges/cryptolive}/cryptolive.go (100%) rename {cryptolive => cryptoexchanges/cryptolive}/widget.go (100%) diff --git a/cryptolive/cryptolive.go b/cryptoexchanges/cryptolive/cryptolive.go similarity index 100% rename from cryptolive/cryptolive.go rename to cryptoexchanges/cryptolive/cryptolive.go diff --git a/cryptolive/widget.go b/cryptoexchanges/cryptolive/widget.go similarity index 100% rename from cryptolive/widget.go rename to cryptoexchanges/cryptolive/widget.go From 5301eae6bfb49dd53b3c592a2618f4092d719ab0 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Sun, 3 Jun 2018 05:28:33 +0430 Subject: [PATCH 13/17] fixed cryptolive path --- wtf.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wtf.go b/wtf.go index 2f3dec4e..11169c80 100644 --- a/wtf.go +++ b/wtf.go @@ -13,7 +13,7 @@ import ( "github.com/senorprogrammer/wtf/bamboohr" "github.com/senorprogrammer/wtf/clocks" "github.com/senorprogrammer/wtf/cmdrunner" - "github.com/senorprogrammer/wtf/cryptolive" + "github.com/senorprogrammer/wtf/cryptoexchanges/cryptolive" "github.com/senorprogrammer/wtf/gcal" "github.com/senorprogrammer/wtf/git" "github.com/senorprogrammer/wtf/github" From 3c4902835ef30824eb4763368b935a0a04040b36 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Mon, 4 Jun 2018 05:19:20 +0430 Subject: [PATCH 14/17] use map for http response --- cryptoexchanges/cryptolive/cryptolive.go | 28 +----------------------- cryptoexchanges/cryptolive/widget.go | 3 +-- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/cryptoexchanges/cryptolive/cryptolive.go b/cryptoexchanges/cryptolive/cryptolive.go index 462c144e..b9e641a0 100644 --- a/cryptoexchanges/cryptolive/cryptolive.go +++ b/cryptoexchanges/cryptolive/cryptolive.go @@ -15,33 +15,7 @@ type toCurrency struct { price float32 } -type cResponse struct { - BTC float32 `json:"BTC"` - HBZ float32 `json:"HBZ"` - ETH float32 `json:"ETH"` - EOS float32 `json:"EOS"` - BCH float32 `json:"BCH"` - TRX float32 `json:"TRX"` - XRP float32 `json:"XRP"` - LTC float32 `json:"LTC"` - ETC float32 `json:"ETC"` - ADA float32 `json:"ADA"` - CMT float32 `json:"CMT"` - DASH float32 `json:"DASH"` - ZEC float32 `json:"ZEC"` - IOT float32 `json:"IOT"` - ONT float32 `json:"ONT"` - NEO float32 `json:"NEO"` - BTG float32 `json:"BTG"` - LSK float32 `json:"LSK"` - ELA float32 `json:"ELA"` - DTA float32 `json:"DTA"` - NANO float32 `json:"NANO"` - WTC float32 `json:"WTC"` - DOGE float32 `json:"DOGE"` - USD float32 `json:"USD"` - EUR float32 `json:"EUR"` -} +type cResponse map[string]float32 /* -------------------- Unexported Functions -------------------- */ diff --git a/cryptoexchanges/cryptolive/widget.go b/cryptoexchanges/cryptolive/widget.go index bdfc6655..b7f76103 100644 --- a/cryptoexchanges/cryptolive/widget.go +++ b/cryptoexchanges/cryptolive/widget.go @@ -174,8 +174,7 @@ func makeRequest(currency *fromCurrency) *http.Request { } func setPrices(response *cResponse, currencry *fromCurrency) { - responseRef := reflect.Indirect(reflect.ValueOf(response)) for idx, toCurrency := range currencry.to { - currencry.to[idx].price = responseRef.FieldByName(toCurrency.name).Interface().(float32) + currencry.to[idx].price = (*response)[toCurrency.name] } } From cf33e2acec058ed11bc142fe16938d25dd45097b Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sun, 3 Jun 2018 20:13:27 -0700 Subject: [PATCH 15/17] Add documentation for CryptoLive --- .../modules/cryptocurrencies/cryptolive.md | 88 ++++++++ _site/content/posts/modules/gcal.md | 2 +- .../hyde-hyde/layouts/partials/sidebar.html | 1 + docs/404.html | 1 + docs/categories/index.html | 1 + docs/index.html | 1 + docs/index.xml | 20 +- .../posts/configuration/attributes/index.html | 1 + docs/posts/configuration/index.html | 1 + docs/posts/configuration/iterm2/index.html | 1 + docs/posts/glossary/index.html | 1 + docs/posts/index.html | 8 + docs/posts/index.xml | 20 +- docs/posts/installation/index.html | 1 + docs/posts/modules/bamboohr/index.html | 1 + docs/posts/modules/clocks/index.html | 1 + docs/posts/modules/cmdrunner/index.html | 1 + .../cryptocurrencies/cryptolive/index.html | 201 ++++++++++++++++++ docs/posts/modules/gcal/index.html | 1 + docs/posts/modules/git/index.html | 1 + docs/posts/modules/github/index.html | 1 + docs/posts/modules/index.html | 1 + docs/posts/modules/ipinfo/index.html | 1 + docs/posts/modules/jira/index.html | 1 + docs/posts/modules/newrelic/index.html | 1 + docs/posts/modules/opsgenie/index.html | 1 + docs/posts/modules/power/index.html | 1 + docs/posts/modules/prettyweather/index.html | 1 + docs/posts/modules/security/index.html | 1 + docs/posts/modules/textfile/index.html | 1 + docs/posts/modules/todo/index.html | 1 + docs/posts/modules/weather/index.html | 1 + docs/posts/overview/index.html | 1 + docs/sitemap.xml | 9 +- docs/tags/index.html | 1 + 35 files changed, 371 insertions(+), 5 deletions(-) create mode 100644 _site/content/posts/modules/cryptocurrencies/cryptolive.md create mode 100644 docs/posts/modules/cryptocurrencies/cryptolive/index.html diff --git a/_site/content/posts/modules/cryptocurrencies/cryptolive.md b/_site/content/posts/modules/cryptocurrencies/cryptolive.md new file mode 100644 index 00000000..7d511c0b --- /dev/null +++ b/_site/content/posts/modules/cryptocurrencies/cryptolive.md @@ -0,0 +1,88 @@ +--- +title: "Cryptolive" +date: 2018-06-03T20:06:40-07:00 +draft: false +--- + +Added in `v0.0.5`. + +Compare crypto currencies using [CryptoCompare](https://cryptocompare.com). + +## Source Code + +```bash +wtf/cryptocurrencies/cryptolive/ +``` + +## Required ENV Vars + +None. + +## Keyboard Commands + +None. + +## Configuration + +```yaml +cryptolive: + colors: + from: + name: coral + displayName: grey + to: + name: white + price: green + currencies: + BTC: + displayName: Bitcoin + to: + - USD + - EUR + - ETH + ETH: + displayName: Ethereum + to: + - USD + - EUR + - ETH + enabled: true + position: + top: 5 + left: 2 + height: 1 + width: 2 + refreshInterval: 30 + updateInterval: 15 +``` + +### Attributes + +`colors.from.name`
    +Values: Any X11 +color name. + +`colors.from.dispayName`
    +Values: Any X11 +color name. + +`colors.to.name`
    +Values: Any X11 +color name. + +`colors.to.price`
    +Values: Any X11 +color name. + +`currencies`
    + +`enabled`
    +Determines whether or not this module is executed and if its data displayed onscreen.
    +Values: `true`, `false`. + +`position`
    +Defines where in the grid this module's widget will be displayed.
    + +`refreshInterval`
    +How often, in seconds, this module will update its data.
    +Values: A positive integer, `0..n`. diff --git a/_site/content/posts/modules/gcal.md b/_site/content/posts/modules/gcal.md index a5774fd3..3376f814 100644 --- a/_site/content/posts/modules/gcal.md +++ b/_site/content/posts/modules/gcal.md @@ -8,7 +8,7 @@ Displays your upcoming Google calendar events. gcal screenshot -**Not:** Setting up access to Google Calendars for Go is a bit unobvious. Check out Google's [Go Quickstart](https://developers.google.com/calendar/quickstart/go) +**Not:** Setting up access to Google Calendars for Go is a bit unobvious. Check out Google's [Go Quickstart](https://developers.google.com/calendar/quickstart/go) first and if you have problems, then take a look at this [comment by WesleydeSouza](https://github.com/senorprogrammer/wtf/issues/83#issuecomment-393665229) which offers a slightly different approach. ## Source Code diff --git a/_site/themes/hyde-hyde/layouts/partials/sidebar.html b/_site/themes/hyde-hyde/layouts/partials/sidebar.html index 8f91fd8e..dbf4b12b 100644 --- a/_site/themes/hyde-hyde/layouts/partials/sidebar.html +++ b/_site/themes/hyde-hyde/layouts/partials/sidebar.html @@ -24,6 +24,7 @@ + diff --git a/docs/404.html b/docs/404.html index 4eed2f2b..1d0472f5 100644 --- a/docs/404.html +++ b/docs/404.html @@ -65,6 +65,7 @@ + diff --git a/docs/categories/index.html b/docs/categories/index.html index 263164e0..5fe1e86c 100644 --- a/docs/categories/index.html +++ b/docs/categories/index.html @@ -67,6 +67,7 @@ + diff --git a/docs/index.html b/docs/index.html index 99ae1e75..ec1f2290 100644 --- a/docs/index.html +++ b/docs/index.html @@ -66,6 +66,7 @@ + diff --git a/docs/index.xml b/docs/index.xml index 2b3ff365..ff336a7b 100644 --- a/docs/index.xml +++ b/docs/index.xml @@ -6,11 +6,29 @@ Recent content on WTF - A Terminal Dashboard Hugo -- gohugo.io en-us - Sat, 02 Jun 2018 05:32:04 -0700 + Sun, 03 Jun 2018 20:06:40 -0700 + + Cryptolive + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + Sun, 03 Jun 2018 20:06:40 -0700 + + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + Added in v0.0.5. +Compare crypto currencies using CryptoCompare. +Source Code wtf/cryptocurrencies/cryptolive/ Required ENV Vars None. +Keyboard Commands None. +Configuration cryptolive:colors:from:name:coraldisplayName:greyto:name:whiteprice:greencurrencies:BTC:displayName:Bitcointo:-USD-EUR-ETHETH:displayName:Ethereumto:-USD-EUR-ETHenabled:trueposition:top:5left:2height:1width:2refreshInterval:30updateInterval:15 Attributes colors.from.name Values: Any X11 color name. +colors.from.dispayName Values: Any X11 color name. +colors.to.name Values: Any X11 color name. +colors.to.price Values: Any X11 color name. +currencies enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module’s widget will be displayed. + + Prettyweather https://wtfutil.com/posts/modules/prettyweather/ diff --git a/docs/posts/configuration/attributes/index.html b/docs/posts/configuration/attributes/index.html index 76a1a2cb..471b05aa 100644 --- a/docs/posts/configuration/attributes/index.html +++ b/docs/posts/configuration/attributes/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/configuration/index.html b/docs/posts/configuration/index.html index ddf6f629..02125fe1 100644 --- a/docs/posts/configuration/index.html +++ b/docs/posts/configuration/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/configuration/iterm2/index.html b/docs/posts/configuration/iterm2/index.html index 5c395343..7490a0a8 100644 --- a/docs/posts/configuration/iterm2/index.html +++ b/docs/posts/configuration/iterm2/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/glossary/index.html b/docs/posts/glossary/index.html index d4533935..14cede16 100644 --- a/docs/posts/glossary/index.html +++ b/docs/posts/glossary/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/index.html b/docs/posts/index.html index 7409e432..c5612a65 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -67,6 +67,7 @@ + @@ -97,6 +98,13 @@

    Posts

    • + + Cryptolive + + + + +
    • Prettyweather diff --git a/docs/posts/index.xml b/docs/posts/index.xml index 21b14d1e..89b03cfe 100644 --- a/docs/posts/index.xml +++ b/docs/posts/index.xml @@ -6,11 +6,29 @@ Recent content in Posts on WTF - A Terminal Dashboard Hugo -- gohugo.io en-us - Sat, 02 Jun 2018 05:32:04 -0700 + Sun, 03 Jun 2018 20:06:40 -0700 + + Cryptolive + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + Sun, 03 Jun 2018 20:06:40 -0700 + + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + Added in v0.0.5. +Compare crypto currencies using CryptoCompare. +Source Code wtf/cryptocurrencies/cryptolive/ Required ENV Vars None. +Keyboard Commands None. +Configuration cryptolive:colors:from:name:coraldisplayName:greyto:name:whiteprice:greencurrencies:BTC:displayName:Bitcointo:-USD-EUR-ETHETH:displayName:Ethereumto:-USD-EUR-ETHenabled:trueposition:top:5left:2height:1width:2refreshInterval:30updateInterval:15 Attributes colors.from.name Values: Any X11 color name. +colors.from.dispayName Values: Any X11 color name. +colors.to.name Values: Any X11 color name. +colors.to.price Values: Any X11 color name. +currencies enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module’s widget will be displayed. + + Prettyweather https://wtfutil.com/posts/modules/prettyweather/ diff --git a/docs/posts/installation/index.html b/docs/posts/installation/index.html index 3b10455f..2e247ca7 100644 --- a/docs/posts/installation/index.html +++ b/docs/posts/installation/index.html @@ -65,6 +65,7 @@
    • + diff --git a/docs/posts/modules/bamboohr/index.html b/docs/posts/modules/bamboohr/index.html index 410377b0..060a883a 100644 --- a/docs/posts/modules/bamboohr/index.html +++ b/docs/posts/modules/bamboohr/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/clocks/index.html b/docs/posts/modules/clocks/index.html index acb297d0..fdb2bc05 100644 --- a/docs/posts/modules/clocks/index.html +++ b/docs/posts/modules/clocks/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/cmdrunner/index.html b/docs/posts/modules/cmdrunner/index.html index 22e9ddbf..51243f46 100644 --- a/docs/posts/modules/cmdrunner/index.html +++ b/docs/posts/modules/cmdrunner/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/cryptocurrencies/cryptolive/index.html b/docs/posts/modules/cryptocurrencies/cryptolive/index.html new file mode 100644 index 00000000..cd17c393 --- /dev/null +++ b/docs/posts/modules/cryptocurrencies/cryptolive/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + + + +Cryptolive | WTF - A Terminal Dashboard + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +

      Cryptolive

      + +
      + +
      + + + +

      Added in v0.0.5.

      + +

      Compare crypto currencies using CryptoCompare.

      + +

      Source Code

      +
      wtf/cryptocurrencies/cryptolive/
      +

      Required ENV Vars

      + +

      None.

      + +

      Keyboard Commands

      + +

      None.

      + +

      Configuration

      +
      cryptolive:
      +  colors:
      +    from:
      +      name: coral
      +      displayName: grey
      +    to:
      +      name: white
      +      price: green
      +  currencies:
      +    BTC:
      +      displayName: Bitcoin
      +      to:
      +        - USD
      +        - EUR
      +        - ETH
      +    ETH:
      +      displayName: Ethereum
      +      to:
      +        - USD
      +        - EUR
      +        - ETH
      +  enabled: true
      +  position:
      +    top: 5
      +    left: 2
      +    height: 1
      +    width: 2
      +  refreshInterval: 30
      +  updateInterval: 15
      +

      Attributes

      + +

      colors.from.name
      +Values: Any X11 +color name.

      + +

      colors.from.dispayName
      +Values: Any X11 +color name.

      + +

      colors.to.name
      +Values: Any X11 +color name.

      + +

      colors.to.price
      +Values: Any X11 +color name.

      + +

      currencies

      + +

      enabled
      +Determines whether or not this module is executed and if its data displayed onscreen.
      +Values: true, false.

      + +

      position
      +Defines where in the grid this module’s widget will be displayed.

      + +

      refreshInterval
      +How often, in seconds, this module will update its data.
      +Values: A positive integer, 0..n.

      + +
      + + +
      + + + + diff --git a/docs/posts/modules/gcal/index.html b/docs/posts/modules/gcal/index.html index 6991cc95..06d9687a 100644 --- a/docs/posts/modules/gcal/index.html +++ b/docs/posts/modules/gcal/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/git/index.html b/docs/posts/modules/git/index.html index 5036a5b5..54fbf39d 100644 --- a/docs/posts/modules/git/index.html +++ b/docs/posts/modules/git/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/github/index.html b/docs/posts/modules/github/index.html index 92ccd756..a6af2afb 100644 --- a/docs/posts/modules/github/index.html +++ b/docs/posts/modules/github/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/index.html b/docs/posts/modules/index.html index f6fe6128..0f23575f 100644 --- a/docs/posts/modules/index.html +++ b/docs/posts/modules/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/ipinfo/index.html b/docs/posts/modules/ipinfo/index.html index 82387b46..d8263157 100644 --- a/docs/posts/modules/ipinfo/index.html +++ b/docs/posts/modules/ipinfo/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/jira/index.html b/docs/posts/modules/jira/index.html index de2bb5b5..49a069e2 100644 --- a/docs/posts/modules/jira/index.html +++ b/docs/posts/modules/jira/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/newrelic/index.html b/docs/posts/modules/newrelic/index.html index 95ce89aa..33523eb5 100644 --- a/docs/posts/modules/newrelic/index.html +++ b/docs/posts/modules/newrelic/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/opsgenie/index.html b/docs/posts/modules/opsgenie/index.html index dbecdaba..af21cf3b 100644 --- a/docs/posts/modules/opsgenie/index.html +++ b/docs/posts/modules/opsgenie/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/power/index.html b/docs/posts/modules/power/index.html index d0acf8d0..0a9f05ad 100644 --- a/docs/posts/modules/power/index.html +++ b/docs/posts/modules/power/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/prettyweather/index.html b/docs/posts/modules/prettyweather/index.html index 2502de3e..84169e4d 100644 --- a/docs/posts/modules/prettyweather/index.html +++ b/docs/posts/modules/prettyweather/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/security/index.html b/docs/posts/modules/security/index.html index 371e5197..eaa66c7c 100644 --- a/docs/posts/modules/security/index.html +++ b/docs/posts/modules/security/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/textfile/index.html b/docs/posts/modules/textfile/index.html index e1a0bc26..19d5f84b 100644 --- a/docs/posts/modules/textfile/index.html +++ b/docs/posts/modules/textfile/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/todo/index.html b/docs/posts/modules/todo/index.html index 45c15d11..ae296a70 100644 --- a/docs/posts/modules/todo/index.html +++ b/docs/posts/modules/todo/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/modules/weather/index.html b/docs/posts/modules/weather/index.html index 953f1f37..eeeefa97 100644 --- a/docs/posts/modules/weather/index.html +++ b/docs/posts/modules/weather/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/posts/overview/index.html b/docs/posts/overview/index.html index 3b8c7f0d..d66ec009 100644 --- a/docs/posts/overview/index.html +++ b/docs/posts/overview/index.html @@ -65,6 +65,7 @@ + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 486fc7eb..38034fc0 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -2,6 +2,11 @@ + + https://wtfutil.com/posts/modules/cryptocurrencies/cryptolive/ + 2018-06-03T20:06:40-07:00 + + https://wtfutil.com/posts/modules/prettyweather/ 2018-06-02T05:32:04-07:00 @@ -124,7 +129,7 @@ https://wtfutil.com/posts/ - 2018-06-02T05:32:04-07:00 + 2018-06-03T20:06:40-07:00 0 @@ -135,7 +140,7 @@ https://wtfutil.com/ - 2018-06-02T05:32:04-07:00 + 2018-06-03T20:06:40-07:00 0 diff --git a/docs/tags/index.html b/docs/tags/index.html index 3d782109..5124d493 100644 --- a/docs/tags/index.html +++ b/docs/tags/index.html @@ -67,6 +67,7 @@ + From c14902abb6ff9b7c67c3ff94941e48143235e379 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sun, 3 Jun 2018 20:22:40 -0700 Subject: [PATCH 16/17] Tweak the formatting of the CryptoLive module a bit --- cryptoexchanges/cryptolive/widget.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cryptoexchanges/cryptolive/widget.go b/cryptoexchanges/cryptolive/widget.go index b7f76103..c45cf0b1 100644 --- a/cryptoexchanges/cryptolive/widget.go +++ b/cryptoexchanges/cryptolive/widget.go @@ -98,7 +98,7 @@ func display(widget *Widget) { toPriceColor = Config.UString("wtf.mods.cryptolive.colors.to.price", "green") ) for _, item := range widget.list.items { - str += fmt.Sprintf("[%s]%s[%s](%s):\n", fromNameColor, item.displayName, fromDisplayNameColor, item.name) + str += fmt.Sprintf(" [%s]%s[%s] (%s)\n", fromNameColor, item.displayName, fromDisplayNameColor, item.name) for _, toItem := range item.to { str += fmt.Sprintf("\t[%s]%s: [%s]%f\n", toNameColor, toItem.name, toPriceColor, toItem.price) } @@ -116,7 +116,7 @@ func getToList(fromName string) []*toCurrency { for _, to := range toNames { toList = append(toList, &toCurrency{ name: to.(string), - price: -1, + price: 0, }) } From 218b6937b13e6da801e22913da1ece900cfcd3ee Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sun, 3 Jun 2018 20:54:07 -0700 Subject: [PATCH 17/17] Implement ASCII-only widget titles Widget titles can now be specified in the config file via a 'title' key. Example: wtf: mods: todo: title: Tada which can include emoji. No need to force everyone to look at my emoji, now they can define their own. --- bamboohr/widget.go | 4 ++-- clocks/widget.go | 2 +- cmdrunner/widget.go | 2 +- cryptoexchanges/cryptolive/widget.go | 3 +-- gcal/widget.go | 2 +- git/display.go | 2 +- github/display.go | 2 +- jira/widget.go | 6 +++--- newrelic/widget.go | 2 +- opsgenie/widget.go | 4 ++-- power/widget.go | 2 +- prettyweather/widget.go | 3 +-- security/widget.go | 2 +- status/widget.go | 2 +- system/widget.go | 2 +- textfile/widget.go | 4 ++-- todo/widget.go | 2 +- 17 files changed, 22 insertions(+), 24 deletions(-) diff --git a/bamboohr/widget.go b/bamboohr/widget.go index a2b5f443..5876f567 100644 --- a/bamboohr/widget.go +++ b/bamboohr/widget.go @@ -16,7 +16,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" ðŸ‘― BambooHR ", "bamboohr", false), + TextWidget: wtf.NewTextWidget(" BambooHR ", "bamboohr", false), } return &widget @@ -37,7 +37,7 @@ func (widget *Widget) Refresh() { ) widget.UpdateRefreshedAt() - widget.View.SetTitle(fmt.Sprintf(" ðŸ‘― Away (%d) ", len(todayItems))) + widget.View.SetTitle(fmt.Sprintf("%s(%d)", widget.Name, len(todayItems))) widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(todayItems))) } diff --git a/clocks/widget.go b/clocks/widget.go index 3dff6cae..0e1a7fdc 100644 --- a/clocks/widget.go +++ b/clocks/widget.go @@ -18,7 +18,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" 🕗 World Clocks ", "clocks", false), + TextWidget: wtf.NewTextWidget(" World Clocks ", "clocks", false), } widget.clockColl = widget.buildClockCollection(Config.UMap("wtf.mods.clocks.locations")) diff --git a/cmdrunner/widget.go b/cmdrunner/widget.go index bb25dac6..3c80ae5a 100644 --- a/cmdrunner/widget.go +++ b/cmdrunner/widget.go @@ -22,7 +22,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" 🏃 Runner ", "cmdrunner", false), + TextWidget: wtf.NewTextWidget(" CmdRunner ", "cmdrunner", false), args: wtf.ToStrs(Config.UList("wtf.mods.cmdrunner.args")), cmd: Config.UString("wtf.mods.cmdrunner.cmd"), diff --git a/cryptoexchanges/cryptolive/widget.go b/cryptoexchanges/cryptolive/widget.go index c45cf0b1..e59eef96 100644 --- a/cryptoexchanges/cryptolive/widget.go +++ b/cryptoexchanges/cryptolive/widget.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "net/http" - "reflect" "time" "github.com/olebedev/config" @@ -32,7 +31,7 @@ type Widget struct { func NewWidget() *Widget { started = false widget := Widget{ - TextWidget: wtf.NewTextWidget(" $ CryptoLive ", "cryptolive", false), + TextWidget: wtf.NewTextWidget(" CryptoLive ", "cryptolive", false), updateInterval: Config.UInt("wtf.mods.cryptolive.updateInterval", 10), } diff --git a/gcal/widget.go b/gcal/widget.go index 6e2df90c..3b343627 100644 --- a/gcal/widget.go +++ b/gcal/widget.go @@ -20,7 +20,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" ðŸŋ Calendar ", "gcal", false), + TextWidget: wtf.NewTextWidget(" Calendar ", "gcal", false), } return &widget diff --git a/git/display.go b/git/display.go index e809224f..8140615b 100644 --- a/git/display.go +++ b/git/display.go @@ -17,7 +17,7 @@ func (widget *Widget) display() { } title := fmt.Sprintf("[green]%s[white]\n", repoData.Repository) - widget.View.SetTitle(fmt.Sprintf(" Git: %s ", title)) + widget.View.SetTitle(fmt.Sprintf("%s- %s", widget.Name, title)) str := wtf.SigilStr(len(widget.Data), widget.Idx, widget.View) + "\n" str = str + " [red]Branch[white]\n" diff --git a/github/display.go b/github/display.go index 1d35ef1b..e9346367 100644 --- a/github/display.go +++ b/github/display.go @@ -14,7 +14,7 @@ func (widget *Widget) display() { return } - widget.View.SetTitle(fmt.Sprintf(" Github: %s ", widget.title(repo))) + widget.View.SetTitle(fmt.Sprintf("%s- %s", widget.Name, widget.title(repo))) str := wtf.SigilStr(len(widget.GithubRepos), widget.Idx, widget.View) + "\n" str = str + " [red]Stats[white]\n" diff --git a/jira/widget.go b/jira/widget.go index ebe85237..d9fe19f1 100644 --- a/jira/widget.go +++ b/jira/widget.go @@ -16,7 +16,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget("JIRA", "jira", false), + TextWidget: wtf.NewTextWidget(" Jira ", "jira", false), } return &widget @@ -35,13 +35,13 @@ func (widget *Widget) Refresh() { if err != nil { widget.View.SetWrap(true) - widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name)) + widget.View.SetTitle(fmt.Sprintf("%s", widget.Name)) fmt.Fprintf(widget.View, "%v", err) } else { widget.View.SetWrap(false) widget.View.SetTitle( fmt.Sprintf( - " %s: [green]%s[white] ", + "%s- [green]%s[white]", widget.Name, Config.UString("wtf.mods.jira.project"), ), diff --git a/newrelic/widget.go b/newrelic/widget.go index 61a72a95..2831ea08 100644 --- a/newrelic/widget.go +++ b/newrelic/widget.go @@ -39,7 +39,7 @@ func (widget *Widget) Refresh() { } widget.UpdateRefreshedAt() - widget.View.SetTitle(fmt.Sprintf(" New Relic: [green]%s[white] ", appName)) + widget.View.SetTitle(fmt.Sprintf("%s- [green]%s[white]", widget.Name, appName)) widget.View.Clear() if depErr != nil { diff --git a/opsgenie/widget.go b/opsgenie/widget.go index 1089c918..bf72c006 100644 --- a/opsgenie/widget.go +++ b/opsgenie/widget.go @@ -17,7 +17,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" ⏰ OpsGenie ", "opsgenie", false), + TextWidget: wtf.NewTextWidget(" OpsGenie ", "opsgenie", false), } return &widget @@ -33,7 +33,7 @@ func (widget *Widget) Refresh() { data, err := Fetch() widget.UpdateRefreshedAt() - widget.View.SetTitle(" ⏰ On Call ") + widget.View.SetTitle(widget.Name) if err != nil { widget.View.SetWrap(true) diff --git a/power/widget.go b/power/widget.go index bd7a3652..dc98d6ae 100644 --- a/power/widget.go +++ b/power/widget.go @@ -18,7 +18,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" ⚡ïļ Power ", "power", false), + TextWidget: wtf.NewTextWidget(" Power ", "power", false), Battery: NewBattery(), } diff --git a/prettyweather/widget.go b/prettyweather/widget.go index d4e237ea..6b838c69 100644 --- a/prettyweather/widget.go +++ b/prettyweather/widget.go @@ -22,7 +22,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget("Pretty Weather", "prettyweather", false), + TextWidget: wtf.NewTextWidget(" Pretty Weather ", "prettyweather", false), } return &widget @@ -35,7 +35,6 @@ func (widget *Widget) Refresh() { widget.UpdateRefreshedAt() widget.prettyWeather() - widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name)) widget.View.SetText(fmt.Sprintf("%s", widget.result)) } diff --git a/security/widget.go b/security/widget.go index 2ec6ba3f..a6161fd9 100644 --- a/security/widget.go +++ b/security/widget.go @@ -17,7 +17,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" ðŸĪš Security ", "security", false), + TextWidget: wtf.NewTextWidget(" Security ", "security", false), } return &widget diff --git a/status/widget.go b/status/widget.go index 83d2861e..6550fe5f 100644 --- a/status/widget.go +++ b/status/widget.go @@ -18,7 +18,7 @@ type Widget struct { func NewWidget() *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" 🎉 Status ", "status", false), + TextWidget: wtf.NewTextWidget(" Status ", "status", false), CurrentIcon: 0, } diff --git a/system/widget.go b/system/widget.go index 6da695f8..29f9efd0 100644 --- a/system/widget.go +++ b/system/widget.go @@ -21,7 +21,7 @@ type Widget struct { func NewWidget(date, version string) *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" Build ", "system", false), + TextWidget: wtf.NewTextWidget(" System ", "system", false), Date: date, Version: version, diff --git a/textfile/widget.go b/textfile/widget.go index 12f2a7fa..d581dc4f 100644 --- a/textfile/widget.go +++ b/textfile/widget.go @@ -30,7 +30,7 @@ type Widget struct { func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" 📄 Text File ", "textfile", true), + TextWidget: wtf.NewTextWidget(" Text File ", "textfile", true), app: app, filePath: Config.UString("wtf.mods.textfile.filePath"), @@ -53,7 +53,7 @@ func (widget *Widget) Refresh() { } widget.UpdateRefreshedAt() - widget.View.SetTitle(fmt.Sprintf(" 📄 %s ", widget.filePath)) + widget.View.SetTitle(fmt.Sprintf("%s %s", widget.Name, widget.filePath)) filePath, _ := wtf.ExpandHomeDir(widget.filePath) diff --git a/todo/widget.go b/todo/widget.go index df66bac4..f0b15503 100644 --- a/todo/widget.go +++ b/todo/widget.go @@ -44,7 +44,7 @@ type Widget struct { func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { widget := Widget{ - TextWidget: wtf.NewTextWidget(" 📝 Todo ", "todo", true), + TextWidget: wtf.NewTextWidget(" Todo ", "todo", true), app: app, filePath: Config.UString("wtf.mods.todo.filename"),