summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-03 02:12:54 -0600
committerJeff Carr <[email protected]>2025-03-03 02:12:54 -0600
commit6d1dfed3db9c08b85fd40c1592edf3c730b5b348 (patch)
treed46ec5b2442c94e95d105dbde89d967d51b5ccc6
parent65cf744a8643d63780fed3fc2f60cbe289f54cac (diff)
set global options in init
-rw-r--r--help.go4
-rw-r--r--init.go5
-rw-r--r--libnotify.go2
-rw-r--r--structs.go2
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