mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Streamlining the widget creation process a bit more. Coords into config
This commit is contained in:
parent
cbf5b45c62
commit
9bda045ce1
84
config.yml
84
config.yml
@ -1,12 +1,12 @@
|
||||
wtf:
|
||||
refreshInterval: 1
|
||||
bamboohr:
|
||||
enabled: false
|
||||
enabled: true
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 900
|
||||
url: "https://api.bamboohr.com/api/gateway.php"
|
||||
gcal:
|
||||
@ -14,83 +14,83 @@ wtf:
|
||||
enabled: true
|
||||
eventCount: 10
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 2
|
||||
left: 1
|
||||
height: 4
|
||||
width: 1
|
||||
refreshInterval: 300
|
||||
secretFile: "~/.wtf/gcal/client_secret.json"
|
||||
git:
|
||||
commitCount: 5
|
||||
enabled: true
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 0
|
||||
left: 2
|
||||
height: 2
|
||||
width: 3
|
||||
refreshInterval: 8
|
||||
repository: "/Users/chris/go/src/github.com/senorprogrammer/wtf"
|
||||
github:
|
||||
enabled: true
|
||||
organization: "BetterOfficeApps"
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 2
|
||||
left: 2
|
||||
height: 2
|
||||
width: 3
|
||||
refreshInterval: 300
|
||||
repo: "core-api"
|
||||
username: "senorprogrammer"
|
||||
jira:
|
||||
enabled: true
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 1
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 900
|
||||
newrelic:
|
||||
applicationId: 10549735
|
||||
enabled: true
|
||||
deployCount: 5
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 4
|
||||
left: 2
|
||||
height: 1
|
||||
width: 3
|
||||
refreshInterval: 900
|
||||
opsgenie:
|
||||
enabled: true
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 2
|
||||
left: 0
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 21600
|
||||
security:
|
||||
enabled: false
|
||||
enabled: true
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 5
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
status:
|
||||
enabled: true
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 5
|
||||
left: 2
|
||||
height: 3
|
||||
width: 3
|
||||
refreshInterval: 1
|
||||
weather:
|
||||
cityId: 6173331
|
||||
enabled: true
|
||||
language: "EN"
|
||||
position:
|
||||
top:
|
||||
left:
|
||||
width:
|
||||
height:
|
||||
top: 0
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
tempUnit: "C"
|
||||
refreshInterval: 900
|
||||
|
24
wtf.go
24
wtf.go
@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
//"fmt"
|
||||
//"os"
|
||||
"time"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
@ -37,7 +39,16 @@ func addToApp(grid *tview.Grid, widget wtf.TextViewer) {
|
||||
return
|
||||
}
|
||||
|
||||
grid.AddItem(widget.TextView(), 0, 0, 2, 1, 0, 0, false)
|
||||
grid.AddItem(
|
||||
widget.TextView(),
|
||||
widget.Top(),
|
||||
widget.Left(),
|
||||
widget.Height(),
|
||||
widget.Width(),
|
||||
0,
|
||||
0,
|
||||
false, // has focus
|
||||
)
|
||||
}
|
||||
|
||||
var result = wtf.CreateConfigDir()
|
||||
@ -104,17 +115,6 @@ func main() {
|
||||
addToApp(grid, jira)
|
||||
addToApp(grid, stat)
|
||||
|
||||
//grid.AddItem(bamboo.View, 0, 0, 2, 1, 0, 0, false)
|
||||
//grid.AddItem(cal.View, 2, 1, 4, 1, 0, 0, false)
|
||||
//grid.AddItem(git.View, 0, 2, 2, 3, 0, 0, false)
|
||||
//grid.AddItem(github.View, 2, 2, 2, 3, 0, 0, false)
|
||||
//grid.AddItem(newrelic.View, 4, 2, 1, 3, 0, 0, false)
|
||||
//grid.AddItem(weather.View, 0, 1, 1, 1, 0, 0, false)
|
||||
//grid.AddItem(sec.View, 5, 0, 1, 1, 0, 0, false)
|
||||
//grid.AddItem(opsgenie.View, 2, 0, 2, 1, 0, 0, false)
|
||||
//grid.AddItem(jira.View, 1, 1, 1, 1, 0, 0, false)
|
||||
//grid.AddItem(stat.View, 5, 2, 3, 3, 0, 0, false)
|
||||
|
||||
app := tview.NewApplication()
|
||||
|
||||
// Loop in a routine to redraw the screen
|
||||
|
@ -7,4 +7,8 @@ import (
|
||||
type TextViewer interface {
|
||||
Enabler
|
||||
TextView() *tview.TextView
|
||||
Top() int
|
||||
Left() int
|
||||
Width() int
|
||||
Height() int
|
||||
}
|
||||
|
@ -11,20 +11,39 @@ import (
|
||||
var Config *config.Config
|
||||
|
||||
type Position struct {
|
||||
Top int
|
||||
Left int
|
||||
Width int
|
||||
Height int
|
||||
top int
|
||||
left int
|
||||
width int
|
||||
height int
|
||||
}
|
||||
|
||||
func (pos *Position) Top() int {
|
||||
return pos.top
|
||||
}
|
||||
|
||||
func (pos *Position) Left() int {
|
||||
return pos.left
|
||||
}
|
||||
|
||||
func (pos *Position) Width() int {
|
||||
return pos.width
|
||||
}
|
||||
|
||||
func (pos *Position) Height() int {
|
||||
return pos.height
|
||||
}
|
||||
|
||||
/* -------------------- TextWidget -------------------- */
|
||||
|
||||
type TextWidget struct {
|
||||
enabled bool
|
||||
|
||||
Name string
|
||||
Position Position
|
||||
RefreshedAt time.Time
|
||||
RefreshInt int
|
||||
View *tview.TextView
|
||||
|
||||
Position
|
||||
}
|
||||
|
||||
func NewTextWidget(name string, configKey string) TextWidget {
|
||||
@ -32,6 +51,12 @@ func NewTextWidget(name string, configKey string) TextWidget {
|
||||
enabled: Config.UBool(fmt.Sprintf("wtf.%s.enabled", configKey), false),
|
||||
Name: name,
|
||||
RefreshInt: Config.UInt(fmt.Sprintf("wtf.%s.refreshInterval", configKey)),
|
||||
Position: Position{
|
||||
top: Config.UInt(fmt.Sprintf("wtf.%s.position.top", configKey)),
|
||||
left: Config.UInt(fmt.Sprintf("wtf.%s.position.left", configKey)),
|
||||
height: Config.UInt(fmt.Sprintf("wtf.%s.position.height", configKey)),
|
||||
width: Config.UInt(fmt.Sprintf("wtf.%s.position.width", configKey)),
|
||||
},
|
||||
}
|
||||
|
||||
return widget
|
||||
|
Loading…
x
Reference in New Issue
Block a user