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:
|
wtf:
|
||||||
refreshInterval: 1
|
refreshInterval: 1
|
||||||
bamboohr:
|
bamboohr:
|
||||||
enabled: false
|
enabled: true
|
||||||
position:
|
position:
|
||||||
top:
|
top: 0
|
||||||
left:
|
left: 0
|
||||||
width:
|
height: 2
|
||||||
height:
|
width: 1
|
||||||
refreshInterval: 900
|
refreshInterval: 900
|
||||||
url: "https://api.bamboohr.com/api/gateway.php"
|
url: "https://api.bamboohr.com/api/gateway.php"
|
||||||
gcal:
|
gcal:
|
||||||
@ -14,83 +14,83 @@ wtf:
|
|||||||
enabled: true
|
enabled: true
|
||||||
eventCount: 10
|
eventCount: 10
|
||||||
position:
|
position:
|
||||||
top:
|
top: 2
|
||||||
left:
|
left: 1
|
||||||
width:
|
height: 4
|
||||||
height:
|
width: 1
|
||||||
refreshInterval: 300
|
refreshInterval: 300
|
||||||
secretFile: "~/.wtf/gcal/client_secret.json"
|
secretFile: "~/.wtf/gcal/client_secret.json"
|
||||||
git:
|
git:
|
||||||
commitCount: 5
|
commitCount: 5
|
||||||
enabled: true
|
enabled: true
|
||||||
position:
|
position:
|
||||||
top:
|
top: 0
|
||||||
left:
|
left: 2
|
||||||
width:
|
height: 2
|
||||||
height:
|
width: 3
|
||||||
refreshInterval: 8
|
refreshInterval: 8
|
||||||
repository: "/Users/chris/go/src/github.com/senorprogrammer/wtf"
|
repository: "/Users/chris/go/src/github.com/senorprogrammer/wtf"
|
||||||
github:
|
github:
|
||||||
enabled: true
|
enabled: true
|
||||||
organization: "BetterOfficeApps"
|
organization: "BetterOfficeApps"
|
||||||
position:
|
position:
|
||||||
top:
|
top: 2
|
||||||
left:
|
left: 2
|
||||||
width:
|
height: 2
|
||||||
height:
|
width: 3
|
||||||
refreshInterval: 300
|
refreshInterval: 300
|
||||||
repo: "core-api"
|
repo: "core-api"
|
||||||
username: "senorprogrammer"
|
username: "senorprogrammer"
|
||||||
jira:
|
jira:
|
||||||
enabled: true
|
enabled: true
|
||||||
position:
|
position:
|
||||||
top:
|
top: 1
|
||||||
left:
|
left: 1
|
||||||
width:
|
height: 1
|
||||||
height:
|
width: 1
|
||||||
refreshInterval: 900
|
refreshInterval: 900
|
||||||
newrelic:
|
newrelic:
|
||||||
applicationId: 10549735
|
applicationId: 10549735
|
||||||
enabled: true
|
enabled: true
|
||||||
deployCount: 5
|
deployCount: 5
|
||||||
position:
|
position:
|
||||||
top:
|
top: 4
|
||||||
left:
|
left: 2
|
||||||
width:
|
height: 1
|
||||||
height:
|
width: 3
|
||||||
refreshInterval: 900
|
refreshInterval: 900
|
||||||
opsgenie:
|
opsgenie:
|
||||||
enabled: true
|
enabled: true
|
||||||
position:
|
position:
|
||||||
top:
|
top: 2
|
||||||
left:
|
left: 0
|
||||||
width:
|
height: 2
|
||||||
height:
|
width: 1
|
||||||
refreshInterval: 21600
|
refreshInterval: 21600
|
||||||
security:
|
security:
|
||||||
enabled: false
|
enabled: true
|
||||||
position:
|
position:
|
||||||
top:
|
top: 5
|
||||||
left:
|
left: 0
|
||||||
width:
|
height: 1
|
||||||
height:
|
width: 1
|
||||||
refreshInterval: 3600
|
refreshInterval: 3600
|
||||||
status:
|
status:
|
||||||
enabled: true
|
enabled: true
|
||||||
position:
|
position:
|
||||||
top:
|
top: 5
|
||||||
left:
|
left: 2
|
||||||
width:
|
height: 3
|
||||||
height:
|
width: 3
|
||||||
refreshInterval: 1
|
refreshInterval: 1
|
||||||
weather:
|
weather:
|
||||||
cityId: 6173331
|
cityId: 6173331
|
||||||
enabled: true
|
enabled: true
|
||||||
language: "EN"
|
language: "EN"
|
||||||
position:
|
position:
|
||||||
top:
|
top: 0
|
||||||
left:
|
left: 1
|
||||||
width:
|
height: 1
|
||||||
height:
|
width: 1
|
||||||
tempUnit: "C"
|
tempUnit: "C"
|
||||||
refreshInterval: 900
|
refreshInterval: 900
|
||||||
|
24
wtf.go
24
wtf.go
@ -1,6 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
//"fmt"
|
||||||
|
//"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rivo/tview"
|
"github.com/rivo/tview"
|
||||||
@ -37,7 +39,16 @@ func addToApp(grid *tview.Grid, widget wtf.TextViewer) {
|
|||||||
return
|
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()
|
var result = wtf.CreateConfigDir()
|
||||||
@ -104,17 +115,6 @@ func main() {
|
|||||||
addToApp(grid, jira)
|
addToApp(grid, jira)
|
||||||
addToApp(grid, stat)
|
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()
|
app := tview.NewApplication()
|
||||||
|
|
||||||
// Loop in a routine to redraw the screen
|
// Loop in a routine to redraw the screen
|
||||||
|
@ -7,4 +7,8 @@ import (
|
|||||||
type TextViewer interface {
|
type TextViewer interface {
|
||||||
Enabler
|
Enabler
|
||||||
TextView() *tview.TextView
|
TextView() *tview.TextView
|
||||||
|
Top() int
|
||||||
|
Left() int
|
||||||
|
Width() int
|
||||||
|
Height() int
|
||||||
}
|
}
|
||||||
|
@ -11,20 +11,39 @@ import (
|
|||||||
var Config *config.Config
|
var Config *config.Config
|
||||||
|
|
||||||
type Position struct {
|
type Position struct {
|
||||||
Top int
|
top int
|
||||||
Left int
|
left int
|
||||||
Width int
|
width int
|
||||||
Height 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 {
|
type TextWidget struct {
|
||||||
enabled bool
|
enabled bool
|
||||||
|
|
||||||
Name string
|
Name string
|
||||||
Position Position
|
|
||||||
RefreshedAt time.Time
|
RefreshedAt time.Time
|
||||||
RefreshInt int
|
RefreshInt int
|
||||||
View *tview.TextView
|
View *tview.TextView
|
||||||
|
|
||||||
|
Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTextWidget(name string, configKey string) TextWidget {
|
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),
|
enabled: Config.UBool(fmt.Sprintf("wtf.%s.enabled", configKey), false),
|
||||||
Name: name,
|
Name: name,
|
||||||
RefreshInt: Config.UInt(fmt.Sprintf("wtf.%s.refreshInterval", configKey)),
|
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
|
return widget
|
||||||
|
Loading…
x
Reference in New Issue
Block a user