-
-
Notifications
You must be signed in to change notification settings - Fork 811
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add keyboard controls to lunarphase module (#1444)
* Add keyboard controls * Fix lint error from golangci-lint in pull request checks * More 'gofmt -s' updates to satisfy lint check in pull request * Fix hang with rapid requests from keyboard input * Remove unused 'today' variable
- Loading branch information
1 parent
0a2d029
commit 4012dd3
Showing
4 changed files
with
147 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package lunarphase | ||
|
||
import "github.com/gdamore/tcell/v2" | ||
|
||
func (widget *Widget) initializeKeyboardControls() { | ||
widget.InitializeHelpTextKeyboardControl(widget.ShowHelp) | ||
widget.InitializeRefreshKeyboardControl(widget.Refresh) | ||
|
||
widget.SetKeyboardChar("n", widget.NextDay, "Show next day lunar phase") | ||
widget.SetKeyboardChar("p", widget.PrevDay, "Show previous day lunar phase") | ||
widget.SetKeyboardChar("t", widget.Today, "Show today lunar phase") | ||
widget.SetKeyboardChar("N", widget.NextWeek, "Show next week lunar phase") | ||
widget.SetKeyboardChar("P", widget.PrevWeek, "Show previous week lunar phase") | ||
widget.SetKeyboardChar("o", widget.OpenMoonPhase, "Open 'Moon Phase for Today' in browser") | ||
|
||
widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevDay, "Show previous day lunar phase") | ||
widget.SetKeyboardKey(tcell.KeyRight, widget.NextDay, "Show next day lunar phase") | ||
widget.SetKeyboardKey(tcell.KeyUp, widget.NextWeek, "Show next week lunar phase") | ||
widget.SetKeyboardKey(tcell.KeyDown, widget.PrevWeek, "Show previous week lunar phase") | ||
widget.SetKeyboardKey(tcell.KeyEnter, widget.OpenMoonPhase, "Open 'Moon Phase for Today' in browser") | ||
widget.SetKeyboardKey(tcell.KeyCtrlD, widget.DisableWidget, "Disable/Enable this widget instance") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters