name change libnotify 'menu' to 'icon'

This commit is contained in:
Jeff Carr 2025-03-04 13:35:13 -06:00
parent b8781b1b64
commit 96eac58cf5
5 changed files with 51 additions and 51 deletions

View File

@ -207,7 +207,7 @@ func (tk *guiWidget) setColorButtonDense() {
tk.updateColor() tk.updateColor()
} }
func (tk *guiWidget) setColorNotifyMenu() { func (tk *guiWidget) setColorNotifyIcon() {
if tk.color == nil { if tk.color == nil {
tk.color = new(colorT) tk.color = new(colorT)
} }

View File

@ -43,17 +43,17 @@ func doMouseClick(w int, h int) {
win := findWindowUnderMouse() win := findWindowUnderMouse()
if win == nil { if win == nil {
log.Log(INFO, "click() nothing was at:", w, h) log.Log(INFO, "click() nothing was at:", w, h)
log.Log(INFO, "click() check if", w, h, "is the libnotify menu") log.Log(INFO, "click() check if", w, h, "is the libnotify icon")
if me.notify.menu.tk != nil && me.notify.menu.tk.gocuiSize.inRect(w, h) { if me.notify.icon.tk != nil && me.notify.icon.tk.gocuiSize.inRect(w, h) {
log.Log(GOCUI, "click() is libnotify menu!") log.Log(GOCUI, "click() is libnotify.icon!")
if me.notify.menu.active { if me.notify.icon.active {
log.Info("show notify menu here") log.Info("show notify.icon here")
setNotifyMenuText("[X]") setNotifyIconText("[X]")
me.notify.menu.active = false me.notify.icon.active = false
} else { } else {
log.Info("hide notify menu here") log.Info("hide notify.icon here")
setNotifyMenuText("[ ]") setNotifyIconText("[ ]")
me.notify.menu.active = true me.notify.icon.active = true
} }
return return
} }

View File

@ -75,7 +75,7 @@ func toolkitInit() {
// SETUP libnotify clock and menu // SETUP libnotify clock and menu
me.notify.clock.once.Do(makeNotifyClock) me.notify.clock.once.Do(makeNotifyClock)
me.notify.menu.once.Do(makeNotifyMenu) me.notify.icon.once.Do(makeNotifyIcon)
// PUT INIT DEBUG COOE HERE // PUT INIT DEBUG COOE HERE
var toggle bool var toggle bool
@ -190,9 +190,9 @@ func initPlugin() {
me.notify.clock.offsetW = 13 me.notify.clock.offsetW = 13
me.notify.clock.offsetH = 1 me.notify.clock.offsetH = 1
me.notify.menu.wId = -6 me.notify.icon.wId = -6
me.notify.menu.offsetW = 4 me.notify.icon.offsetW = 4
me.notify.menu.offsetH = 1 me.notify.icon.offsetH = 1
me.notify.help.wId = -7 me.notify.help.wId = -7
me.notify.help.offsetH = 3 me.notify.help.offsetH = 3

View File

@ -67,21 +67,21 @@ func makeNotifyClock() {
} }
func makeNotifyMenu() { func makeNotifyIcon() {
if me.treeRoot == nil { if me.treeRoot == nil {
log.Info("gogui makeClock() error. treeRoot == nil") log.Info("gogui makeClock() error. treeRoot == nil")
return return
} }
me.notify.menu.tk = makeNewInternalWidget(me.notify.menu.wId) me.notify.icon.tk = makeNewInternalWidget(me.notify.icon.wId)
me.notify.menu.tk.dumpWidget("init() menu") me.notify.icon.tk.dumpWidget("init() menu")
w, _ := me.baseGui.Size() w, _ := me.baseGui.Size()
me.notify.menu.tk.MoveToOffset(w-5, me.notify.menu.offsetH) me.notify.icon.tk.MoveToOffset(w-5, me.notify.icon.offsetH)
me.notify.menu.tk.labelN = "[ ]" me.notify.icon.tk.labelN = "[ ]"
me.notify.menu.tk.frame = false me.notify.icon.tk.frame = false
me.notify.menu.tk.setColorNotifyMenu() me.notify.icon.tk.setColorNotifyIcon()
me.notify.menu.tk.Show() me.notify.icon.tk.Show()
me.notify.menu.active = true me.notify.icon.active = true
me.notify.menu.tk.dumpWidget("notifyMenu()") me.notify.icon.tk.dumpWidget("notifyIcon()")
} }
@ -111,7 +111,7 @@ func libNotifyUpdate() {
me.notify.clock.tk.Show() me.notify.clock.tk.Show()
sigWinchBG() sigWinchBG()
sigWinchMenu() sigWinchIcon()
} }
// update the time // update the time
@ -122,30 +122,30 @@ func libNotifyUpdate() {
// hardDrawUnderMouse(me.notify.clock.tk, "clock") // hardDrawUnderMouse(me.notify.clock.tk, "clock")
// log.Info("libNotifyUpdate updated clock", me.notify.clock.tk.labelN) // log.Info("libNotifyUpdate updated clock", me.notify.clock.tk.labelN)
if me.notify.menu.tk == nil { if me.notify.icon.tk == nil {
log.Info("libNotifyUpdate error menu.tk == nil") log.Info("libNotifyUpdate error menu.tk == nil")
return return
} }
if me.notify.menu.tk.v == nil { if me.notify.icon.tk.v == nil {
log.Info("libNotifyUpdate error menu.tk.v == nil") log.Info("libNotifyUpdate error menu.tk.v == nil")
return return
} }
// update the menu // update the menu
hardDrawAtgocuiSize(me.notify.menu.tk) hardDrawAtgocuiSize(me.notify.icon.tk)
me.notify.menu.tk.setColorNotifyMenu() me.notify.icon.tk.setColorNotifyIcon()
me.baseGui.SetViewOnTop(me.notify.menu.tk.v.Name()) me.baseGui.SetViewOnTop(me.notify.icon.tk.v.Name())
me.baseGui.SetViewOnTop(me.notify.clock.tk.v.Name()) me.baseGui.SetViewOnTop(me.notify.clock.tk.v.Name())
} }
func setNotifyMenuText(s string) { func setNotifyIconText(s string) {
me.notify.menu.tk.v.Clear() me.notify.icon.tk.v.Clear()
me.notify.menu.tk.labelN = s me.notify.icon.tk.labelN = s
me.notify.menu.tk.v.WriteString(me.notify.menu.tk.labelN) me.notify.icon.tk.v.WriteString(me.notify.icon.tk.labelN)
hardDrawAtgocuiSize(me.notify.menu.tk) hardDrawAtgocuiSize(me.notify.icon.tk)
me.notify.menu.tk.setColorNotifyMenu() me.notify.icon.tk.setColorNotifyIcon()
me.baseGui.SetViewOnTop(me.notify.menu.tk.v.Name()) me.baseGui.SetViewOnTop(me.notify.icon.tk.v.Name())
log.Info("setNotifyMenuText() updated menu to:", me.notify.menu.tk.labelN) log.Info("setNotifyIconText() updated menu to:", me.notify.icon.tk.labelN)
} }
// 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
@ -161,9 +161,9 @@ func setThingsOnTop() {
me.baseGui.SetViewOnTop(me.notify.clock.tk.v.Name()) me.baseGui.SetViewOnTop(me.notify.clock.tk.v.Name())
} }
if me.notify.menu.tk != nil { if me.notify.icon.tk != nil {
if me.notify.menu.tk.v != nil { if me.notify.icon.tk.v != nil {
me.baseGui.SetViewOnTop(me.notify.menu.tk.v.Name()) me.baseGui.SetViewOnTop(me.notify.icon.tk.v.Name())
} }
} }
@ -238,11 +238,11 @@ func hardDrawAtgocuiSize(tk *guiWidget) {
log.Verbose("hardDrawAtgocuiSize() err ok widget", tk.cuiName, a, b, c, d, tk.v.Name()) log.Verbose("hardDrawAtgocuiSize() err ok widget", tk.cuiName, a, b, c, d, tk.v.Name())
} }
func sigWinchMenu() { func sigWinchIcon() {
w, _ := me.baseGui.Size() w, _ := me.baseGui.Size()
me.notify.menu.tk.MoveToOffset(w-me.notify.menu.offsetW, me.notify.menu.offsetH) me.notify.icon.tk.MoveToOffset(w-me.notify.icon.offsetW, me.notify.icon.offsetH)
me.notify.menu.tk.Hide() me.notify.icon.tk.Hide()
me.notify.menu.tk.Show() me.notify.icon.tk.Show()
} }
func sigWinchBG() { func sigWinchBG() {

View File

@ -149,11 +149,11 @@ type internalTK struct {
// the desktop libnotify menu // the desktop libnotify menu
type libnotify struct { type libnotify struct {
clock internalTK // widget for the clock clock internalTK // widget for the clock
menu internalTK // libnotify menu icon icon internalTK // libnotify menu icon
menuWindow internalTK // libnotify menu window window internalTK // the libnotify menu
window internalTK // the libnotify menu help internalTK // the help menu
help internalTK // the help menu // menuWindow internalTK // libnotify menu window
} }
// this is the gocui way // this is the gocui way