summaryrefslogtreecommitdiff
path: root/libnotify.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-03 08:31:21 -0600
committerJeff Carr <[email protected]>2025-03-03 08:31:21 -0600
commit75014f4b284d3e88266c1ae319ee9bbdb86d3ad2 (patch)
treee7285307e91f4291d4361568ed1f89bd6ad9e1d6 /libnotify.go
parent9ef16c1bf2bfc1e00163b461779383c809efff9f (diff)
define a background widget more properly
Diffstat (limited to 'libnotify.go')
-rw-r--r--libnotify.go42
1 files changed, 30 insertions, 12 deletions
diff --git a/libnotify.go b/libnotify.go
index fc5e897..58ce3b3 100644
--- a/libnotify.go
+++ b/libnotify.go
@@ -144,19 +144,37 @@ func setThingsOnTop() {
setBottomBG()
}
+// find the "BG" widget and set it to the background on the very very bottom
func setBottomBG() {
- // this attempts to find the "BG" widget and set it to the background on the very very bottom
- rootTK := me.treeRoot.TK.(*guiWidget)
- if tk := rootTK.findBG(); tk != nil {
- // log.Info("found BG. setting to bottom", tk.cuiName)
- if me.dark {
- tk.v.BgColor = gocui.ColorBlack
- } else {
- tk.v.BgColor = gocui.ColorWhite
- }
- tk.v.Clear()
- me.baseGui.SetViewOnBottom(tk.cuiName)
+ if me.BG.tk == nil {
+ log.Info("background tk widget not initialized")
+ return
+ }
+ tk := me.BG.tk
+ log.Info("found BG. setting to bottom", tk.cuiName)
+ if tk.v == nil {
w, h := me.baseGui.Size()
- me.baseGui.SetView(tk.cuiName, -1, -1, w+1, h+1, 0)
+ a := -1
+ b := -1
+ c := w + 1
+ d := h + 1
+ var err error
+ tk.v, err = me.baseGui.SetView(tk.cuiName, a, b, c, d, 0)
+ if err == nil {
+ tk.dumpWidget("drawView() err")
+ log.Log(ERROR, "drawView() internal plugin error err = nil")
+ return
+ }
+ log.Info("background tk View not initialized")
+ return
}
+ if me.dark {
+ tk.v.BgColor = gocui.ColorBlack
+ } else {
+ tk.v.BgColor = gocui.ColorWhite
+ }
+ tk.v.Clear()
+ me.baseGui.SetViewOnBottom(tk.cuiName)
+ w, h := me.baseGui.Size()
+ me.baseGui.SetView(tk.cuiName, -1, -1, w+1, h+1, 0)
}