Compare commits

...

3 Commits

Author SHA1 Message Date
Jeff Carr 86aa5fb001 reverse in STDOUT is no longer the default 2025-09-03 01:56:01 -05:00
Jeff Carr 262426fb44 make the help menu appear when libnotify is clicked 2025-09-03 01:23:22 -05:00
Jeff Carr ec0807ce2b minor 2025-08-16 21:49:54 -05:00
7 changed files with 51 additions and 12 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
go.mod go.mod
go.sum go.sum
gocui gocui
resources/*.so

View File

@ -58,6 +58,7 @@ func registerHandlers(g *gocui.Gui) {
g.SetKeybinding("", 'L', gocui.ModNone, printWidgetTree) // 'L' list all widgets in tree view g.SetKeybinding("", 'L', gocui.ModNone, printWidgetTree) // 'L' list all widgets in tree view
g.SetKeybinding("", 'f', gocui.ModNone, theFind) // 'f' shows what is under your mouse g.SetKeybinding("", 'f', gocui.ModNone, theFind) // 'f' shows what is under your mouse
g.SetKeybinding("", 'd', gocui.ModNone, theLetterD) // 'd' toggles on and off debugging buttons g.SetKeybinding("", 'd', gocui.ModNone, theLetterD) // 'd' toggles on and off debugging buttons
g.SetKeybinding("", 'r', gocui.ModNone, reverseStdout) // 'r' turns scrolling of STDOUT upside down
g.SetKeybinding("", 'q', gocui.ModNone, quit) // 'q' only exits gocui. plugin stays alive (?) g.SetKeybinding("", 'q', gocui.ModNone, quit) // 'q' only exits gocui. plugin stays alive (?)
} }
@ -103,7 +104,9 @@ func theDarkness(g *gocui.Gui, v *gocui.View) error {
log.Info("you have seen the light") log.Info("you have seen the light")
} else { } else {
me.dark = true me.dark = true
log.Info("you have entered into darkness") log.Info("you have entered into darkness (you may need to trigger SIGWINCH)")
log.Info("or maybe open a new window. notsure. This obviously isn't finished.")
log.Info("submit patches to this and you will definitely get free cloud credits at WIT")
} }
return nil return nil
} }
@ -182,6 +185,19 @@ func theFind(g *gocui.Gui, v *gocui.View) error {
return nil return nil
} }
func reverseStdout(g *gocui.Gui, v *gocui.View) error {
if me.stdout.reverse {
me.stdout.reverse = false
log.Info("stdout scrolling normal")
} else {
me.stdout.reverse = true
log.Info("stdout scrolling is reversed. this is sometimes useful when you")
log.Info("only need to see a few most recent lines and have the STDOUT window")
log.Info("take up minimal realestate at the bottom of your window")
}
return nil
}
// is run whenever anyone hits 'd' (in an open space) // is run whenever anyone hits 'd' (in an open space)
func theLetterD(g *gocui.Gui, v *gocui.View) error { func theLetterD(g *gocui.Gui, v *gocui.View) error {
// widgets that don't have physical existance in // widgets that don't have physical existance in

View File

@ -77,12 +77,20 @@ func stdoutHome(g *gocui.Gui, v *gocui.View) error {
} }
func stdoutArrowUp(g *gocui.Gui, v *gocui.View) error { func stdoutArrowUp(g *gocui.Gui, v *gocui.View) error {
stdoutWheelsUp() if me.stdout.reverse {
stdoutWheelsDown()
} else {
stdoutWheelsUp()
}
return nil return nil
} }
func stdoutArrowDown(g *gocui.Gui, v *gocui.View) error { func stdoutArrowDown(g *gocui.Gui, v *gocui.View) error {
stdoutWheelsDown() if me.stdout.reverse {
stdoutWheelsUp()
} else {
stdoutWheelsDown()
}
return nil return nil
} }

20
help.go
View File

@ -25,16 +25,20 @@ import (
var helpText []string = []string{"Help Menu", var helpText []string = []string{"Help Menu",
"", "",
"Tab: toggle through windows", "Tab toggle through windows",
"O: toggle STDOUT", "'O' toggle STDOUT",
"H: toggle this gocui menu", "'H' toggle this gocui menu",
"L: toggle light/dark mode", "'D' toggle light/dark mode",
"CTRL-c: quit()", "CTRL-z background to shell",
"CTRL-c quit()",
"", "",
"Debugging:", "Debugging:",
"S: Supermouse mode", "'S' Supermouse mode",
"M: list all widget positions", "'M' list all widget positions",
"L: list all widgets in tree", "'L' list all widgets in tree",
"<Pgup> scroll up the STDOUT window",
"<Pgdn> scroll down the STDOUT window",
"'r' reverse STDOUT scrolling",
} }
func hideHelp() { func hideHelp() {

View File

@ -154,6 +154,13 @@ func setNotifyIconText(s string) {
for _, tk := range me.allwin { for _, tk := range me.allwin {
log.Info("known window Window", tk.labelN, tk.window.active, tk.window.order) log.Info("known window Window", tk.labelN, tk.window.active, tk.window.order)
} }
if s == "[X]" {
log.Warn("should turn on help window here")
showHelp()
} else {
log.Warn("should turn off help window here")
hideHelp()
}
} }
// in the very end of redrawing things, this will place the help and stdout on the top or botton // in the very end of redrawing things, this will place the help and stdout on the top or botton

View File

@ -211,7 +211,9 @@ func (tk *guiWidget) refreshStdout() {
// chop off the last lines in the buffer // chop off the last lines in the buffer
chop := len(me.stdout.outputS) - (me.stdout.pager + me.stdout.h) chop := len(me.stdout.outputS) - (me.stdout.pager + me.stdout.h)
cur = append(cur, me.stdout.outputS[chop:chop+me.stdout.h]...) cur = append(cur, me.stdout.outputS[chop:chop+me.stdout.h]...)
slices.Reverse(cur) if me.stdout.reverse {
slices.Reverse(cur)
}
tk.v.Clear() tk.v.Clear()
fmt.Fprintln(tk.v, strings.Join(cur, "\n")) fmt.Fprintln(tk.v, strings.Join(cur, "\n"))
} }

View File

@ -120,6 +120,7 @@ type stdout struct {
outputS []string // the buffer of all the output outputS []string // the buffer of all the output
pager int // allows the user to page through the buffer pager int // allows the user to page through the buffer
changed bool // indicates the user has changed stdout. gocui should remember the state here changed bool // indicates the user has changed stdout. gocui should remember the state here
reverse bool // flip the STDOUT upside down so new STDOUT lines are at the top
} }
// settings for the dropdown window // settings for the dropdown window