1
0
mirror of https://github.com/taigrr/wtf synced 2026-03-30 17:25:21 -07:00

Add an app exit banner message

This commit is contained in:
Chris Cummer
2020-07-20 05:35:06 -07:00
parent 84763f3947
commit 9f94e8c63a
10 changed files with 436 additions and 24 deletions

View File

@@ -87,6 +87,10 @@ func (wtfApp *WtfApp) stopAllWidgets() {
func (wtfApp *WtfApp) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
// These keys are global keys used by the app. Widgets should not implement these keys
switch event.Key() {
case tcell.KeyCtrlC:
wtfApp.Stop()
wtfApp.app.Stop()
wtfApp.DisplayExitMessage()
case tcell.KeyCtrlR:
wtfApp.refreshAllWidgets()
return nil
@@ -142,8 +146,8 @@ func (wtfApp *WtfApp) watchForConfigChanges() {
config := cfg.LoadWtfConfigFile(wtfApp.configFilePath)
newApp := NewWtfApp(wtfApp.app, config, wtfApp.configFilePath)
openUrlUtil := utils.ToStrs(config.UList("wtf.openUrlUtil", []interface{}{}))
utils.Init(config.UString("wtf.openFileUtil", "open"), openUrlUtil)
openURLUtil := utils.ToStrs(config.UList("wtf.openUrlUtil", []interface{}{}))
utils.Init(config.UString("wtf.openFileUtil", "open"), openURLUtil)
newApp.Start()
case err := <-watch.Error: