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()
}
func (tk *guiWidget) setColorNotifyMenu() {
func (tk *guiWidget) setColorNotifyIcon() {
if tk.color == nil {
tk.color = new(colorT)
}

View File

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

View File

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

View File

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

View File

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