mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Pressing Return/Enter in the GitHub widget opens the repo GitHub page
This commit is contained in:
parent
c35c4e2e1d
commit
e4efd6ed72
@ -32,6 +32,10 @@ func NewGithubRepo(name, owner string) *GithubRepo {
|
||||
return &repo
|
||||
}
|
||||
|
||||
func (repo *GithubRepo) Open() {
|
||||
wtf.OpenFile(*repo.RemoteRepo.HTMLURL)
|
||||
}
|
||||
|
||||
// Refresh reloads the github data via the Github API
|
||||
func (repo *GithubRepo) Refresh() {
|
||||
repo.PullRequests, _ = repo.loadPullRequests()
|
||||
|
@ -113,6 +113,9 @@ func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
||||
}
|
||||
|
||||
switch event.Key() {
|
||||
case tcell.KeyEnter:
|
||||
widget.openRepo()
|
||||
return nil
|
||||
case tcell.KeyLeft:
|
||||
widget.Prev()
|
||||
return nil
|
||||
@ -123,3 +126,11 @@ func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
||||
return event
|
||||
}
|
||||
}
|
||||
|
||||
func (widget *Widget) openRepo() {
|
||||
repo := widget.currentGithubRepo()
|
||||
|
||||
if repo != nil {
|
||||
repo.Open()
|
||||
}
|
||||
}
|
||||
|
2
main.go
2
main.go
@ -219,7 +219,7 @@ func addWidget(app *tview.Application, pages *tview.Pages, widgetName string) {
|
||||
case "status":
|
||||
widgets = append(widgets, status.NewWidget(app))
|
||||
case "system":
|
||||
widgets = append(widgets, system.NewWidget(date, version))
|
||||
widgets = append(widgets, system.NewWidget(app, date, version))
|
||||
case "spotify":
|
||||
widgets = append(widgets, spotify.NewWidget(app, pages))
|
||||
case "textfile":
|
||||
|
Loading…
x
Reference in New Issue
Block a user