From 6d1dfed3db9c08b85fd40c1592edf3c730b5b348 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 3 Mar 2025 02:12:54 -0600 Subject: set global options in init --- help.go | 4 ++-- init.go | 5 +++++ libnotify.go | 2 +- structs.go | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/help.go b/help.go index de9b247..5f5274b 100644 --- a/help.go +++ b/help.go @@ -91,12 +91,12 @@ func showHelp() error { } else { if me.notify.clock.tk == nil { 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.Show() } 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.Show() } diff --git a/init.go b/init.go index 65653b2..7142abf 100644 --- a/init.go +++ b/init.go @@ -149,7 +149,12 @@ func initPlugin() { me.dropdown.wId = -77 me.textbox.wId = -55 me.stdout.wId = -4 + + // the clock widget id and offset me.notify.clock.wId = -5 + me.notify.clock.offsetW = 13 + me.notify.clock.offsetH = 1 + me.notify.menu.wId = -5 Set(&me.dropdown, "default") diff --git a/libnotify.go b/libnotify.go index 19be3c0..fc5e897 100644 --- a/libnotify.go +++ b/libnotify.go @@ -89,7 +89,7 @@ func libNotifyUpdate() { w, h := me.baseGui.Size() if me.winchW != w || me.winchH != 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.Show() me.winchW = w diff --git a/structs.go b/structs.go index b19367d..c85e859 100644 --- a/structs.go +++ b/structs.go @@ -140,6 +140,8 @@ type internalTK struct { callerTK *guiWidget // which widget called the dropdown menu wId int // the widget id to use active bool // is the internal widget currently in use? + offsetW int // width offset + offsetH int // height offset } // the desktop libnotify menu -- cgit v1.2.3