set global options in init

This commit is contained in:
Jeff Carr 2025-03-03 02:12:54 -06:00
parent 65cf744a86
commit 6d1dfed3db
4 changed files with 10 additions and 3 deletions

View File

@ -91,12 +91,12 @@ func showHelp() error {
} else { } else {
if me.notify.clock.tk == nil { if me.notify.clock.tk == nil {
makeClock(me.notify.clock.wId) makeClock(me.notify.clock.wId)
me.notify.clock.tk.MoveToOffset(maxX-10, 1) me.notify.clock.tk.MoveToOffset(maxX-me.notify.clock.offsetW, 1)
me.notify.clock.tk.Hide() me.notify.clock.tk.Hide()
me.notify.clock.tk.Show() me.notify.clock.tk.Show()
} }
if me.notify.clock.tk != nil { if me.notify.clock.tk != nil {
me.notify.clock.tk.MoveToOffset(maxX-10, 1) me.notify.clock.tk.MoveToOffset(maxX-me.notify.clock.offsetW, 1)
me.notify.clock.tk.Hide() me.notify.clock.tk.Hide()
me.notify.clock.tk.Show() me.notify.clock.tk.Show()
} }

View File

@ -149,7 +149,12 @@ func initPlugin() {
me.dropdown.wId = -77 me.dropdown.wId = -77
me.textbox.wId = -55 me.textbox.wId = -55
me.stdout.wId = -4 me.stdout.wId = -4
// the clock widget id and offset
me.notify.clock.wId = -5 me.notify.clock.wId = -5
me.notify.clock.offsetW = 13
me.notify.clock.offsetH = 1
me.notify.menu.wId = -5 me.notify.menu.wId = -5
Set(&me.dropdown, "default") Set(&me.dropdown, "default")

View File

@ -89,7 +89,7 @@ func libNotifyUpdate() {
w, h := me.baseGui.Size() w, h := me.baseGui.Size()
if me.winchW != w || me.winchH != h { if me.winchW != w || me.winchH != h {
log.Info("handle SIGWINCH!", w, h) log.Info("handle SIGWINCH!", w, h)
me.notify.clock.tk.MoveToOffset(w-15, 1) me.notify.clock.tk.MoveToOffset(w-me.notify.clock.offsetW, me.notify.clock.offsetH)
me.notify.clock.tk.Hide() me.notify.clock.tk.Hide()
me.notify.clock.tk.Show() me.notify.clock.tk.Show()
me.winchW = w me.winchW = w

View File

@ -140,6 +140,8 @@ type internalTK struct {
callerTK *guiWidget // which widget called the dropdown menu callerTK *guiWidget // which widget called the dropdown menu
wId int // the widget id to use wId int // the widget id to use
active bool // is the internal widget currently in use? active bool // is the internal widget currently in use?
offsetW int // width offset
offsetH int // height offset
} }
// the desktop libnotify menu // the desktop libnotify menu