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

Merge branch 'master' into autohelp

This commit is contained in:
Chris Cummer 2019-05-12 10:48:29 -07:00 committed by GitHub
commit a2e67fa498
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 208 additions and 367 deletions

View File

@ -9,6 +9,7 @@
* Zendesk widget now has help text, by [@Seanstoppable](https://github.com/Seanstoppable)
* Scrollable widget added to provide common keyboard-navigation list functionality, by [@Seanstoppable](https://github.com/Seanstoppable)
* Logging functionality extracted out from Log module, by [@Seanstoppable](https://github.com/Seanstoppable)
* Improved sample configs with up-to-date attributes and examples, by [@retgits](https://github.com/Seanstoppableretgits)
## v0.9.2

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

View File

@ -14,7 +14,7 @@ wtf:
graphIcon: "💀"
graphStars: 25
position:
top: 2
top: 1
left: 0
height: 2
width: 2

View File

@ -1,236 +0,0 @@
wtf:
colors:
background: gray
border:
focusable: darkslateblue
focused: orange
normal: gray
grid:
# How _wide_ the columns are, in terminal characters. In this case we have
# five columns, each of which are 37 characters wide
columns: [37, 37, 37, 37, 37]
# How _high_ the rows are, in terminal lines. In this case we have five rows
# that support ten line of text, and one of four
rows: [10, 10, 10, 10, 10, 4]
refreshInterval: 1
mods:
bamboohr:
enabled: true
position:
top: 0
left: 0
height: 2
width: 1
refreshInterval: 900
clocks:
colors:
rows:
even: "lightblue"
odd: "white"
enabled: true
locations:
# From https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
Avignon: "Europe/Paris"
Barcelona: "Europe/Madrid"
Dubai: "Asia/Dubai"
UTC: "Etc/UTC"
Vancouver: "America/Vancouver"
Toronto: "America/Toronto"
position:
top: 3
left: 1
height: 1
width: 1
refreshInterval: 15
# Valid options are: alphabetical, chronological
sort: "alphabetical"
cmdrunner:
args: ["-g", "batt"]
cmd: "pmset"
enabled: true
position:
top: 6
left: 2
height: 1
width: 2
refreshInterval: 30
gcal:
colors:
title: "red"
description: "lightblue"
highlights:
- ['1on1|1\/11', 'green']
- ['apple|google|aws', 'blue']
- ['interview|meet\ ', 'lightseagreen']
- ['lunch', 'yellow']
past: "gray"
conflictIcon: "🚨"
currentIcon: "💥"
displayResponseStatus: true
email: "your.email@example.com"
enabled: true
eventCount: 12
position:
top: 0
left: 0
height: 4
width: 1
refreshInterval: 300
secretFile: "~/.config/wtf/gcal/client_secret.json"
withLocation: true
gspreadsheets:
colors:
values: "green"
cells:
names:
- "Cell 1 name"
- "Cell 2 name"
addresses:
- "A1"
- "A2"
enabled: true
position:
top: 0
left: 0
width: 1
height: 1
refreshInterval: "300"
secretFile: "~/.config/wtf/gspreadsheets/client_secret.json"
sheetId: "id_of_google_spreadsheet"
git:
commitCount: 5
enabled: true
position:
top: 0
left: 2
height: 2
width: 3
refreshInterval: 8
repositories:
- "/Users/chris/go/src/github.com/wtfutil/wtf"
github:
enabled: true
position:
top: 2
left: 2
height: 2
width: 3
refreshInterval: 300
repositories:
repo-name: "owner id"
wtf: "wtfutil"
username: "wtfutil"
jira:
colors:
rows:
even: "lightblue"
odd: "white"
domain: "https://company.atlassian.net"
enabled: true
position:
top: 1
left: 1
height: 1
width: 1
project: "WTF"
refreshInterval: 900
username: "chris.cummer"
newrelic:
applicationId: 10594735
enabled: true
deployCount: 10
position:
top: 4
left: 2
height: 2
width: 3
refreshInterval: 900
opsgenie:
displayEmpty: true
enabled: true
position:
top: 2
left: 0
height: 2
width: 1
refreshInterval: 21600
power:
enabled: true
position:
top: 5
left: 0
height: 2
width: 1
refreshInterval: 15
security:
enabled: true
position:
top: 4
left: 0
height: 2
width: 1
refreshInterval: 3600
status:
enabled: false
position:
top: 5
left: 0
height: 1
width: 1
refreshInterval: 1
system:
enabled: true
position:
top: 5
left: 1
height: 2
width: 1
refreshInterval: 3600
todo:
checkedIcon: "X"
colors:
checked: gray
highlight:
fore: "black"
back: "orange"
enabled: true
filename: "todo.yml"
position:
top: 0
left: 1
height: 2
width: 1
refreshInterval: 3600
weather:
apiKey: [YOUR API KEY]
# From http://openweathermap.org/help/city_list.txt
cityids:
- 3370352
- 1283240
WTF_OWM_API_KEY: [YOUR API KEY]
colors:
current: "lightblue"
enabled: true
language: "EN"
position:
top: 2
left: 1
height: 1
width: 1
refreshInterval: 90
tempUnit: "C"
blockfolio:
enabled: true
displayHoldings: true
refreshInterval: 400
device_token: "device token here, you can find how to get it here https://github.com/bob6664569/blockfolio-api-client"
colors:
name: blue
grows: green
drop: red
position:
top: 3
left: 1
width: 1
height: 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 KiB

View File

@ -0,0 +1,180 @@
wtf:
colors:
background: black
border:
focusable: darkslateblue
focused: orange
normal: gray
checked: yellow
highlight:
fore: black
back: gray
rows:
even: yellow
odd: white
grid:
# How _wide_ the columns are, in terminal characters. In this case we have
# four columns, each of which are 35 characters wide.
columns: [35, 35, 35, 35]
# How _high_ the rows are, in terminal lines. In this case we have four rows
# that support ten line of text and one of four.
rows: [10, 10, 10, 10, 4]
refreshInterval: 1
openFileUtil: "open"
mods:
# You can have multiple widgets of the same type.
# The "key" is the name of the widget and the type is the actual
# widget you want to implement.
europe_time:
title: "Europe"
type: clocks
colors:
rows:
even: "lightblue"
odd: "white"
enabled: true
locations:
GMT: "Etc/GMT"
Amsterdam: "Europe/Amsterdam"
Berlin: "Europe/Berlin"
Barcelona: "Europe/Madrid"
Copenhagen: "Europe/Copenhagen"
London: "Europe/London"
Rome: "Europe/Rome"
Stockholm: "Europe/Stockholm"
position:
top: 0
left: 0
height: 1
width: 1
refreshInterval: 15
sort: "alphabetical"
americas_time:
title: "Americas"
type: clocks
colors:
rows:
even: "lightblue"
odd: "white"
enabled: true
locations:
UTC: "Etc/UTC"
Vancouver: "America/Vancouver"
New_York: "America/New_York"
Sao_Paolo: "America/Sao_Paulo"
Denver: "America/Denver"
Iqaluit: "America/Iqaluit"
Bahamas: "America/Nassau"
Chicago: "America/Chicago"
position:
top: 0
left: 1
height: 1
width: 1
refreshInterval: 15
sort: "alphabetical"
battery:
type: power
title: "⚡️"
enabled: true
position:
top: 1
left: 3
height: 1
width: 1
refreshInterval: 15
todolist:
type: todo
checkedIcon: "X"
colors:
checked: gray
highlight:
fore: "black"
back: "orange"
enabled: true
filename: "todo.yml"
position:
top: 1
left: 0
height: 2
width: 1
refreshInterval: 3600
ip:
type: ipinfo
title: "My IP"
colors:
name: "lightblue"
value: "white"
enabled: true
position:
top: 0
left: 2
height: 1
width: 2
refreshInterval: 150
security_info:
type: security
title: "Staying safe"
enabled: true
position:
top: 1
left: 2
height: 1
width: 1
refreshInterval: 3600
readme:
type: textfile
enabled: true
filePaths:
- "~/.config/wtf/config.yml"
format: true
formatStyle: "monokai"
position:
top: 1
left: 1
height: 1
width: 1
refreshInterval: 15
news:
type: hackernews
title: "HackerNews"
enabled: true
numberOfStories: 10
position:
top: 2
left: 1
height: 1
width: 3
storyType: top
refreshInterval: 900
resources:
type: resourceusage
enabled: true
position:
top: 3
left: 0
height: 2
width: 1
refreshInterval: 1
uptime:
type: cmdrunner
args: [""]
cmd: "uptime"
enabled: true
position:
top: 4
left: 1
height: 1
width: 3
refreshInterval: 30
disks:
type: cmdrunner
cmd: "df"
args: ["-h"]
enabled: true
position:
top: 3
left: 1
height: 1
width: 3
refreshInterval: 3600

View File

@ -1,89 +0,0 @@
wtf:
colors:
# background: gray
border:
focusable: darkslateblue
focused: orange
normal: gray
grid:
columns: [40, 40]
rows: [13, 13, 4, 10]
refreshInterval: 1
mods:
clocks:
colors:
rows:
even: "lightblue"
odd: "white"
enabled: true
locations:
Avignon: "Europe/Paris"
Barcelona: "Europe/Madrid"
Dubai: "Asia/Dubai"
UTC: "Etc/UTC"
Vancouver: "America/Vancouver"
Toronto: "America/Toronto"
position:
top: 0
left: 0
height: 1
width: 1
refreshInterval: 15
sort: "alphabetical"
ipinfo:
colors:
name: "lightblue"
value: "white"
enabled: true
position:
top: 3
left: 0
height: 1
width: 1
refreshInterval: 150
power:
enabled: true
position:
top: 3
left: 1
height: 1
width: 1
refreshInterval: 15
title: "⚡️"
security:
enabled: true
position:
top: 1
left: 0
height: 1
width: 1
refreshInterval: 3600
status:
enabled: true
position:
top: 2
left: 0
height: 1
width: 1
refreshInterval: 1
system:
enabled: true
position:
top: 0
left: 1
height: 1
width: 1
refreshInterval: 3600
textfile:
enabled: true
filePaths:
- "~/.config/wtf/config.yml"
- "~/.config/wtf/log.txt"
format: true
formatStyle: "vim"
position:
top: 1
left: 1
height: 2
width: 1
refreshInterval: 15

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

View File

@ -1,15 +1,26 @@
wtf:
colors:
background: black
border:
focusable: darkslateblue
grid:
columns: [40, 40]
rows: [16]
refreshInterval: 1
mods:
clocks:
americas_time:
title: "Americas"
type: clocks
enabled: true
locations:
Toronto: "America/Toronto"
UTC: "Etc/UTC"
Vancouver: "America/Vancouver"
New_York: "America/New_York"
Sao_Paolo: "America/Sao_Paulo"
Denver: "America/Denver"
Iqaluit: "America/Iqaluit"
Bahamas: "America/Nassau"
Chicago: "America/Chicago"
position:
top: 0
left: 0
@ -21,7 +32,6 @@ wtf:
enabled: true
filePaths:
- "~/.config/wtf/config.yml"
- "~/.config/wtf/log.txt"
format: true
formatStyle: "vim"
position:

View File

@ -6,7 +6,8 @@ import (
func (widget *Widget) display(clocks []Clock, dateFormat string, timeFormat string) {
if len(clocks) == 0 {
widget.View.SetText(fmt.Sprintf("\n%s", " no timezone data available"))
title := fmt.Sprintf("\n%s", " no timezone data available")
widget.Redraw(widget.CommonSettings.Title, title, true)
return
}

View File

@ -8,12 +8,12 @@ import (
func (widget *Widget) display() {
if ok == false {
widget.View.SetText(errorText)
widget.Redraw(widget.CommonSettings.Title, errorText, true)
return
}
summaryText := widget.summaryText(&widget.summaryList)
widget.View.SetText(summaryText)
widget.Redraw(widget.CommonSettings.Title, summaryText, false)
}
func (widget *Widget) summaryText(list *summaryList) string {

View File

@ -80,9 +80,7 @@ func makeMarketCurrency(name string) *mCurrency {
func (widget *Widget) Refresh() {
widget.updateSummary()
widget.app.QueueUpdateDraw(func() {
widget.display()
})
widget.display()
}
/* -------------------- Unexported Functions -------------------- */
@ -142,9 +140,7 @@ func (widget *Widget) updateSummary() {
}
}
widget.app.QueueUpdateDraw(func() {
widget.display()
})
widget.display()
}
func makeRequest(baseName, marketName string) *http.Request {

View File

@ -36,15 +36,13 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
func (widget *Widget) Refresh() {
positions, err := Fetch(widget.device_token)
if err != nil {
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
return
}
content := widget.contentFrom(positions)
widget.app.QueueUpdateDraw(func() {
widget.View.SetTitle(widget.CommonSettings.Title)
widget.View.SetText(content)
})
widget.Redraw(widget.CommonSettings.Title, content, false)
}
/* -------------------- Unexported Functions -------------------- */

View File

@ -48,9 +48,7 @@ func (widget *Widget) Refresh() {
widget.toplistWidget.Refresh(&wg)
wg.Wait()
widget.app.QueueUpdateDraw(func() {
widget.display()
})
widget.display()
}
/* -------------------- Unexported Functions -------------------- */
@ -60,5 +58,5 @@ func (widget *Widget) display() {
str += widget.priceWidget.Result
str += widget.toplistWidget.Result
widget.View.SetText(fmt.Sprintf("\n%s", str))
widget.Redraw(widget.CommonSettings.Title, fmt.Sprintf("\n%s", str), false)
}

View File

@ -54,9 +54,7 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
func (widget *Widget) Refresh() {
widget.ipinfo()
widget.app.QueueUpdateDraw(func() {
widget.View.SetText(widget.result)
})
widget.Redraw(widget.CommonSettings.Title, widget.result, false)
}
//this method reads the config and calls ipinfo for ip information

View File

@ -40,10 +40,7 @@ func (widget *Widget) Refresh() {
logLines := widget.tailFile()
widget.app.QueueUpdateDraw(func() {
widget.View.SetTitle(widget.CommonSettings.Title)
widget.View.SetText(widget.contentFrom(logLines))
})
widget.Redraw(widget.CommonSettings.Title, widget.contentFrom(logLines), false)
}
/* -------------------- Unexported Functions -------------------- */

View File

@ -38,7 +38,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget.View.SetWrap(true)
widget.View.SetWordWrap(true)
widget.View.SetTitle(fmt.Sprint("[green]Spotify[white]"))
widget.KeyboardWidget.SetView(widget.View)

View File

@ -122,7 +122,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget.View.SetWrap(true)
widget.View.SetWordWrap(true)
widget.View.SetTitle("[green]Spotify Web[white]")
widget.KeyboardWidget.SetView(widget.View)

View File

@ -68,7 +68,7 @@ func (widget *Widget) display() {
if len(tweets) == 0 {
str := fmt.Sprintf("\n\n\n%s", wtf.CenterText("[lightblue]No Tweets[white]", 50))
widget.View.SetText(str)
widget.Redraw(title, str, true)
return
}

View File

@ -34,7 +34,6 @@ 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.Redraw(widget.CommonSettings.Title, err.Error(), true)
@ -44,16 +43,6 @@ func (widget *Widget) Refresh() {
}
}
func (widget *Widget) display() {
if widget.teams == nil {
return
}
widget.View.SetWrap(false)
widget.View.Clear()
widget.View.SetText(widget.contentFrom(widget.teams))
}
func (widget *Widget) contentFrom(teams []OnCallTeam) string {
var str string