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 {
|
type conf struct {
|
||||||
StoreDir string
|
StoreDir string
|
||||||
ClearDelay int
|
ClearDelay int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,13 +72,13 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Config conf
|
Config conf
|
||||||
l []passgo.Pass
|
l []passgo.Pass
|
||||||
mux sync.Mutex
|
mux sync.Mutex
|
||||||
store passgo.Store
|
store passgo.Store
|
||||||
reload chan struct{}
|
reload chan struct{}
|
||||||
updated chan struct{}
|
updated chan struct{}
|
||||||
passch chan []byte
|
passch chan []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func Updater() {
|
func Updater() {
|
||||||
|
@ -135,7 +135,9 @@ func saveConf(fds ...*os.File) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func eventLoop() {
|
func eventLoop() {
|
||||||
w := app.NewWindow(app.WithWidth(ui.Dp(250)))
|
w := app.NewWindow(
|
||||||
|
app.WithWidth(ui.Dp(250)),
|
||||||
|
app.WithTitle("passgo"))
|
||||||
q := w.Queue()
|
q := w.Queue()
|
||||||
var c ui.Config
|
var c ui.Config
|
||||||
ops := new(ui.Ops)
|
ops := new(ui.Ops)
|
||||||
|
@ -237,13 +239,13 @@ func eventLoop() {
|
||||||
anim := &time.Ticker{}
|
anim := &time.Ticker{}
|
||||||
animating := false
|
animating := false
|
||||||
animOn := func() {
|
animOn := func() {
|
||||||
log(Info,"animOn()")
|
log(Info, "animOn()")
|
||||||
anim = time.NewTicker(time.Second / 120)
|
anim = time.NewTicker(time.Second / 120)
|
||||||
animating = true
|
animating = true
|
||||||
w.Invalidate()
|
w.Invalidate()
|
||||||
}
|
}
|
||||||
animOff := func() {
|
animOff := func() {
|
||||||
log(Info,"animOff()")
|
log(Info, "animOff()")
|
||||||
anim.Stop()
|
anim.Stop()
|
||||||
animating = false
|
animating = false
|
||||||
}
|
}
|
||||||
|
@ -261,7 +263,7 @@ func eventLoop() {
|
||||||
// timing variables used for animation
|
// timing variables used for animation
|
||||||
fade1a, fade1b := 1.5, 2.0
|
fade1a, fade1b := 1.5, 2.0
|
||||||
start2 := float64(Config.ClearDelay)
|
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)
|
cs = flex.Flexible(1.0)
|
||||||
mux.Lock()
|
mux.Lock()
|
||||||
|
@ -286,7 +288,7 @@ func eventLoop() {
|
||||||
log(Info, "Clicked ", btn.Label)
|
log(Info, "Clicked ", btn.Label)
|
||||||
// don't block UI thread on decryption attempt
|
// don't block UI thread on decryption attempt
|
||||||
go func(name string) {
|
go func(name string) {
|
||||||
p,err := store.Decrypt(name, prompt)
|
p, err := store.Decrypt(name, prompt)
|
||||||
//p, err := store.Decrypt(name)
|
//p, err := store.Decrypt(name)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
passgo.Clip(p)
|
passgo.Clip(p)
|
||||||
|
@ -324,9 +326,9 @@ func eventLoop() {
|
||||||
if x >= fade1b && x < start2 && animating {
|
if x >= fade1b && x < start2 && animating {
|
||||||
animOff()
|
animOff()
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(time.Millisecond * time.Duration((start2 - x)*1000))
|
time.Sleep(time.Millisecond * time.Duration((start2-x)*1000))
|
||||||
w.Invalidate()
|
w.Invalidate()
|
||||||
time.Sleep(time.Millisecond * time.Duration((fade2a - start2)*1000))
|
time.Sleep(time.Millisecond * time.Duration((fade2a-start2)*1000))
|
||||||
animOn()
|
animOn()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
@ -363,7 +365,7 @@ func eventLoop() {
|
||||||
dims = al.End(overlay.Layout(c, ops, cs))
|
dims = al.End(overlay.Layout(c, ops, cs))
|
||||||
}
|
}
|
||||||
if x > start2 && x < fade2a {
|
if x > start2 && x < fade2a {
|
||||||
// animOff()
|
// animOff()
|
||||||
}
|
}
|
||||||
if animating && x > end {
|
if animating && x > end {
|
||||||
animOff()
|
animOff()
|
||||||
|
@ -407,7 +409,7 @@ func eventLoop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
promptPage = func() {
|
promptPage = func() {
|
||||||
submit := false
|
submit := false
|
||||||
for e, ok := promptEd.Next(c, q); ok; e, ok = promptEd.Next(c, q) {
|
for e, ok := promptEd.Next(c, q); ok; e, ok = promptEd.Next(c, q) {
|
||||||
switch e.(type) {
|
switch e.(type) {
|
||||||
|
@ -435,7 +437,7 @@ func eventLoop() {
|
||||||
if submit || okBtn.Clicked() {
|
if submit || okBtn.Clicked() {
|
||||||
log(Info, "Ok")
|
log(Info, "Ok")
|
||||||
go func() { // do not block UI thread
|
go func() { // do not block UI thread
|
||||||
passch <-[]byte(promptEd.Text())
|
passch <- []byte(promptEd.Text())
|
||||||
}()
|
}()
|
||||||
w.Invalidate()
|
w.Invalidate()
|
||||||
page = listPage
|
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 {
|
func (b *Button) Clicked() bool {
|
||||||
return b.clicked
|
return b.clicked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,5 +8,5 @@ import (
|
||||||
|
|
||||||
//Clip copies a string to the clipboard
|
//Clip copies a string to the clipboard
|
||||||
func Clip(x string) {
|
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