Add a window title and run go fmt.
This commit is contained in:
parent
dd18765a80
commit
44cab96fff
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user