Add keyboard control for resetting to current day · doctorfree/wtf@0690e1d · GitHub
Skip to content

Commit 0690e1d

Browse files
committed
Add keyboard control for resetting to current day
1 parent 7587d12 commit 0690e1d

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

mkrelease

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
VERSION="1.1.5"
4-
RELEASE=9
3+
VERSION="1.1.6"
4+
RELEASE=1
55

66
usage() {
77
printf "\nUsage: mkrelease [-c] [-d] [-p] [-u]"

modules/lunarphase/keyboard.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ func (widget *Widget) initializeKeyboardControls() {
88

99
widget.SetKeyboardChar("n", widget.NextDay, "Show next day lunar phase")
1010
widget.SetKeyboardChar("p", widget.PrevDay, "Show previous day lunar phase")
11+
widget.SetKeyboardChar("t", widget.Today, "Show today lunar phase")
1112
widget.SetKeyboardChar("N", widget.NextWeek, "Show next week lunar phase")
1213
widget.SetKeyboardChar("P", widget.PrevWeek, "Show previous week lunar phase")
1314
widget.SetKeyboardChar("o", widget.OpenMoonPhase, "Open 'Moon Phase for Today' in browser")

modules/lunarphase/widget.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ func (widget *Widget) PrevDay() {
116116
widget.setDay(yesterday)
117117
}
118118

119+
// Today shows the current day's lunar phase ('t')
120+
func (widget *Widget) Today() {
121+
widget.date = time.Now()
122+
widget.day = widget.date.Format(dateFormat)
123+
widget.RefreshTitle()
124+
}
125+
119126
// PrevWeek shows the previous week's lunar phase (KeyDown / 'P')
120127
func (widget *Widget) PrevWeek() {
121128
lastweek := widget.date.AddDate(0, 0, -7)

0 commit comments

Comments
 (0)