From bc0813b8c7f070743a008003ceb05f0b3d306d7c Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Fri, 10 May 2019 08:47:31 -0700 Subject: [PATCH 1/6] Add Windows build support in goreleaser config --- .goreleaser.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index ba068113..28c8c267 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -7,6 +7,7 @@ builds: goos: - darwin - linux + - windows goarch: - 386 - amd64 From 6765404beea68024af1b8791f46af2cfad5b77b6 Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Fri, 10 May 2019 14:27:26 -0400 Subject: [PATCH 2/6] Add help text to zendesk widget It has keyboard input, so should have a help page --- maker/widget_maker.go | 2 +- modules/zendesk/widget.go | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/maker/widget_maker.go b/maker/widget_maker.go index 4e460d2e..6a40a1d8 100644 --- a/maker/widget_maker.go +++ b/maker/widget_maker.go @@ -198,7 +198,7 @@ func MakeWidget( widget = weather.NewWidget(app, pages, settings) case "zendesk": settings := zendesk.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig) - widget = zendesk.NewWidget(app, settings) + widget = zendesk.NewWidget(app, pages, settings) default: settings := unknown.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig) widget = unknown.NewWidget(app, settings) diff --git a/modules/zendesk/widget.go b/modules/zendesk/widget.go index 8882c54f..4f57b582 100644 --- a/modules/zendesk/widget.go +++ b/modules/zendesk/widget.go @@ -8,8 +8,23 @@ import ( "github.com/wtfutil/wtf/wtf" ) +const HelpText = ` + Keyboard commands for Zendesk: + + /: Show/hide this help window + j: Select the next item in the list + k: Select the previous item in the list + o: Open the selected item in a browser + + arrow down: Select the next item in the list + arrow up: Select the previous item in the list + + return: Open the selected item in a browser +` + // A Widget represents a Zendesk widget type Widget struct { + wtf.HelpfulWidget wtf.KeyboardWidget wtf.TextWidget @@ -19,8 +34,9 @@ type Widget struct { } // NewWidget creates a new instance of a widget -func NewWidget(app *tview.Application, settings *Settings) *Widget { +func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget { widget := Widget{ + HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText), KeyboardWidget: wtf.NewKeyboardWidget(), TextWidget: wtf.NewTextWidget(app, settings.common, true), From 0d2667685e1ae9d64c21b7234087e3d095854005 Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Fri, 10 May 2019 18:46:31 -0400 Subject: [PATCH 3/6] Add stable sort for focusable windows Addresses #435 --- wtf/focus_tracker.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wtf/focus_tracker.go b/wtf/focus_tracker.go index 002c5e10..de935c96 100644 --- a/wtf/focus_tracker.go +++ b/wtf/focus_tracker.go @@ -1,6 +1,8 @@ package wtf import ( + "sort" + "github.com/olebedev/config" "github.com/rivo/tview" ) @@ -177,6 +179,17 @@ func (tracker *FocusTracker) focusables() []Wtfable { } } + // Sort for deterministic ordering + sort.SliceStable(focusable[:], func(i, j int) bool { + if focusable[i].Top() < focusable[j].Top() { + return true + } + if focusable[i].Top() == focusable[j].Top() { + return focusable[i].Left() < focusable[j].Left() + } + return false + }) + return focusable } From 7be64c0558472577ba3277b316f7b6306adc1a45 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Fri, 10 May 2019 23:12:10 -0700 Subject: [PATCH 4/6] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94310733..a514b24a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ ### ⚡️ Added -* DataDog module is now scrollable and interactive, by [@Seanstoppable](https://github.com/Seanstoppable) +* DataDog module is now scrollable and interactive, by @Seanstoppable +* Focusable hot key numbers are now assigned in a stable order, [#435](https://github.com/wtfutil/wtf/issues/435) by @Seanstoppable ## v0.9.2 From d1670413cc361f8e040bff04eacb806fe1bf2011 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Fri, 10 May 2019 23:12:35 -0700 Subject: [PATCH 5/6] Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a514b24a..def47a50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,8 @@ ### ⚡️ Added -* DataDog module is now scrollable and interactive, by @Seanstoppable -* Focusable hot key numbers are now assigned in a stable order, [#435](https://github.com/wtfutil/wtf/issues/435) by @Seanstoppable +* DataDog module is now scrollable and interactive, by [@Seanstoppable](https://github.com/Seanstoppable) +* Focusable hot key numbers are now assigned in a stable order, [#435](https://github.com/wtfutil/wtf/issues/435) by [@Seanstoppable](https://github.com/Seanstoppable) ## v0.9.2 From 04fae35f5b0fe1731ee06fdbb26dea1f049ac533 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Fri, 10 May 2019 23:23:39 -0700 Subject: [PATCH 6/6] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index def47a50..6edb2047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * DataDog module is now scrollable and interactive, by [@Seanstoppable](https://github.com/Seanstoppable) * Focusable hot key numbers are now assigned in a stable order, [#435](https://github.com/wtfutil/wtf/issues/435) by [@Seanstoppable](https://github.com/Seanstoppable) +* Zendesk widget now has help text, by [@Seanstoppable](https://github.com/Seanstoppable) ## v0.9.2