From 44cab96fffdf0b2756a5dabd9762c47c67ae578a Mon Sep 17 00:00:00 2001 From: Greg Date: Fri, 6 Sep 2019 21:14:06 -0400 Subject: [PATCH] Add a window title and run go fmt. --- cmd/passgo-gui/main.go | 38 ++++++++++++++++++++------------------ cmd/passgo-gui/ui.go | 1 - impl_non_darwin.go | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/cmd/passgo-gui/main.go b/cmd/passgo-gui/main.go index e89b739..545896b 100644 --- a/cmd/passgo-gui/main.go +++ b/cmd/passgo-gui/main.go @@ -24,7 +24,7 @@ import ( ) type conf struct { - StoreDir string + StoreDir string ClearDelay int } @@ -72,13 +72,13 @@ func main() { } var ( - Config conf - l []passgo.Pass - mux sync.Mutex - store passgo.Store - reload chan struct{} - updated chan struct{} - passch chan []byte + Config conf + l []passgo.Pass + mux sync.Mutex + store passgo.Store + reload chan struct{} + updated chan struct{} + passch chan []byte ) func Updater() { @@ -135,7 +135,9 @@ func saveConf(fds ...*os.File) { } func eventLoop() { - w := app.NewWindow(app.WithWidth(ui.Dp(250))) + w := app.NewWindow( + app.WithWidth(ui.Dp(250)), + app.WithTitle("passgo")) q := w.Queue() var c ui.Config ops := new(ui.Ops) @@ -237,13 +239,13 @@ func eventLoop() { anim := &time.Ticker{} animating := false animOn := func() { - log(Info,"animOn()") + log(Info, "animOn()") anim = time.NewTicker(time.Second / 120) animating = true w.Invalidate() } animOff := func() { - log(Info,"animOff()") + log(Info, "animOff()") anim.Stop() animating = false } @@ -261,7 +263,7 @@ func eventLoop() { // timing variables used for animation fade1a, fade1b := 1.5, 2.0 start2 := float64(Config.ClearDelay) - fade2a, end := start2 + 1.5, start2 + 2.0 + fade2a, end := start2+1.5, start2+2.0 cs = flex.Flexible(1.0) mux.Lock() @@ -286,7 +288,7 @@ func eventLoop() { log(Info, "Clicked ", btn.Label) // don't block UI thread on decryption attempt go func(name string) { - p,err := store.Decrypt(name, prompt) + p, err := store.Decrypt(name, prompt) //p, err := store.Decrypt(name) if err == nil { passgo.Clip(p) @@ -324,9 +326,9 @@ func eventLoop() { if x >= fade1b && x < start2 && animating { animOff() go func() { - time.Sleep(time.Millisecond * time.Duration((start2 - x)*1000)) + time.Sleep(time.Millisecond * time.Duration((start2-x)*1000)) w.Invalidate() - time.Sleep(time.Millisecond * time.Duration((fade2a - start2)*1000)) + time.Sleep(time.Millisecond * time.Duration((fade2a-start2)*1000)) animOn() }() } @@ -363,7 +365,7 @@ func eventLoop() { dims = al.End(overlay.Layout(c, ops, cs)) } if x > start2 && x < fade2a { - // animOff() + // animOff() } if animating && x > end { animOff() @@ -407,7 +409,7 @@ func eventLoop() { } } - promptPage = func() { + promptPage = func() { submit := false for e, ok := promptEd.Next(c, q); ok; e, ok = promptEd.Next(c, q) { switch e.(type) { @@ -435,7 +437,7 @@ func eventLoop() { if submit || okBtn.Clicked() { log(Info, "Ok") go func() { // do not block UI thread - passch <-[]byte(promptEd.Text()) + passch <- []byte(promptEd.Text()) }() w.Invalidate() page = listPage diff --git a/cmd/passgo-gui/ui.go b/cmd/passgo-gui/ui.go index cd9b161..6eeeada 100644 --- a/cmd/passgo-gui/ui.go +++ b/cmd/passgo-gui/ui.go @@ -127,4 +127,3 @@ func (b *Button) Layout(c ui.Config, q input.Queue, ops *ui.Ops, cs layout.Const func (b *Button) Clicked() bool { return b.clicked } - diff --git a/impl_non_darwin.go b/impl_non_darwin.go index f1a7e8a..e53bb37 100644 --- a/impl_non_darwin.go +++ b/impl_non_darwin.go @@ -8,5 +8,5 @@ import ( //Clip copies a string to the clipboard func Clip(x string) { - log(Info,"Clipboard not implemented for this platform") + log(Info, "Clipboard not implemented for this platform") }