From 13a194dca5d9c6153772d2ef4e1f5ce93f191c6d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 7 Feb 2025 03:26:05 -0600 Subject: [PATCH] more on dark mode --- eventBindings.go | 16 ++++++++++++++-- help.go | 8 +++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/eventBindings.go b/eventBindings.go index 5b39457..121f95f 100644 --- a/eventBindings.go +++ b/eventBindings.go @@ -33,8 +33,9 @@ func registerHandlers(g *gocui.Gui) { g.SetKeybinding("", keyForced, modForced, handle_ctrl_z) // CTRL-Z :cleverly let's you background gocui (breaks cursor mouse on return) // regular keys - g.SetKeybinding("", 'H', gocui.ModNone, theHelp) // '?' toggles on and off the help menu - g.SetKeybinding("", 'O', gocui.ModNone, theStdout) // 'o' toggle the STDOUT window + g.SetKeybinding("", 'H', gocui.ModNone, theHelp) // 'H' toggles on and off the help menu + g.SetKeybinding("", 'O', gocui.ModNone, theStdout) // 'O' toggle the STDOUT window + g.SetKeybinding("", 'D', gocui.ModNone, theDarkness) // 'D' toggles light/dark mode g.SetKeybinding("", 'q', gocui.ModNone, doExit) // 'q' exit g.SetKeybinding("", gocui.KeyTab, gocui.ModNone, tabCycleWindows) // '2' use this to test new ideas g.SetKeybinding("", gocui.KeyPgup, gocui.ModNone, stdoutPgup) // Pgup scroll up the Stdout buffer @@ -108,6 +109,17 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error { return nil } +func theDarkness(g *gocui.Gui, v *gocui.View) error { + if me.dark { + me.dark = false + log.Info("you have seen the light") + } else { + me.dark = true + log.Info("you have entered into darkness") + } + return nil +} + func stdoutPgup(g *gocui.Gui, v *gocui.View) error { me.stdout.pager -= 40 if me.stdout.pager < 0 { diff --git a/help.go b/help.go index 7aa5e62..1948fa8 100644 --- a/help.go +++ b/help.go @@ -26,13 +26,15 @@ import ( var helpText []string = []string{"Help Menu", "", "H: toggle (H)elp", + "D: toggle light/dark mode", + "Tab: toggle through windows", + "q: quit()", + "", + "Debugging:", "O: toggle (O)output (os.STDOUT)", "S: super mouse", "M: list all widgets positions", "L: list all widgets in tree", - "Tab: toggle through windows", - "q: quit()", - "", } func hideHelp() {