diff --git a/cmd/passgo-gui/impl_darwin.go b/cmd/passgo-gui/impl_darwin.go index 62edead..4c8b6db 100644 --- a/cmd/passgo-gui/impl_darwin.go +++ b/cmd/passgo-gui/impl_darwin.go @@ -19,18 +19,18 @@ var ( func setFont() error { f, err := os.Open("/System/Library/Fonts/AppleSDGothicNeo.ttc") if err != nil { - log(Info,"Cannot open system font.") + log(Info, "Cannot open system font.") return err - + } collection, err := sfnt.ParseCollectionReaderAt(f) if err != nil { - log(Info,"Cannot parse system font.") + log(Info, "Cannot parse system font.") return err } regular, err = collection.Font(0) if err != nil { - log(Info,"Cannot access first font in collection.") + log(Info, "Cannot access first font in collection.") return err } return nil @@ -41,7 +41,7 @@ func init() { if err != nil { regular, err = sfnt.Parse(goregular.TTF) if err != nil { - log(Fatal,"Cannot parse default font: ", err) + log(Fatal, "Cannot parse default font: ", err) } } usr, err := user.Current() @@ -52,7 +52,7 @@ func init() { if _, err := os.Stat(confDir); os.IsNotExist(err) { err = os.MkdirAll(confDir, 0700) if err != nil { - log(Info, "Cannot create configuration directory ",confDir) + log(Info, "Cannot create configuration directory ", confDir) log(Fatal, err) } else { log(Info, "Configuration directory created") diff --git a/cmd/passgo-gui/main.go b/cmd/passgo-gui/main.go index 4032b47..3f788b4 100644 --- a/cmd/passgo-gui/main.go +++ b/cmd/passgo-gui/main.go @@ -39,7 +39,7 @@ func main() { confFile := path.Join(confDir, "config.yml") if _, err := os.Stat(confFile); os.IsNotExist(err) { fd, err = os.Create(confFile) - if err != nil { + if err != nil { log(Fatal, "Cannot create configuration file: ", err) } } @@ -52,7 +52,7 @@ func main() { log(Fatal, "Cannot parse configuration file: ", err) } store.Dir = Config.StoreDir - log(Info," StoreDir = ", store.Dir) + log(Info, " StoreDir = ", store.Dir) err = passgo.GetStore(&store) if err != nil { log(Fatal, err) @@ -74,16 +74,16 @@ func main() { } var ( - Config conf - l []passgo.Pass - mux sync.Mutex - store passgo.Store - reload chan struct{} - updated chan struct{} - black = color.RGBA{A: 0xff, R:0, G:0, B:0} - white = color.RGBA{A: 0xff, R:0xff, G:0xff, B:0xff} - gray = color.RGBA{A: 0xff, R:0xf0, G:0xf0, B:0xf0} - darkgray = color.RGBA{A: 0xff, R:0xa0, G:0xa0, B:0xa0} + Config conf + l []passgo.Pass + mux sync.Mutex + store passgo.Store + reload chan struct{} + updated chan struct{} + black = color.RGBA{A: 0xff, R: 0, G: 0, B: 0} + white = color.RGBA{A: 0xff, R: 0xff, G: 0xff, B: 0xff} + gray = color.RGBA{A: 0xff, R: 0xf0, G: 0xf0, B: 0xf0} + darkgray = color.RGBA{A: 0xff, R: 0xa0, G: 0xa0, B: 0xa0} ) func Updater() { @@ -139,12 +139,12 @@ func saveConf(fds ...*os.File) { } type Overlay struct { - Face text.Face - Text string - Click gesture.Click - Color color.RGBA - Background color.RGBA - Alignment text.Alignment + Face text.Face + Text string + Click gesture.Click + Color color.RGBA + Background color.RGBA + Alignment text.Alignment } func (b *Overlay) Layout(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout.Dimensions { @@ -156,8 +156,8 @@ func (b *Overlay) Layout(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout { cs = st.Rigid() l := text.Label{ - Face: b.Face, - Text: b.Text, + Face: b.Face, + Text: b.Text, Alignment: b.Alignment, } ins := layout.UniformInset(ui.Dp(4)) @@ -174,13 +174,13 @@ func (b *Overlay) Layout(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout } type Button struct { - Face text.Face - Label string - Click gesture.Click - Color color.RGBA - Background color.RGBA - Alignment text.Alignment - clicked bool + Face text.Face + Label string + Click gesture.Click + Color color.RGBA + Background color.RGBA + Alignment text.Alignment + clicked bool } func layoutRRect(col color.RGBA, c ui.Config, ops *ui.Ops, cs layout.Constraints) layout.Dimensions { @@ -225,8 +225,8 @@ func (b *Button) Layout(c ui.Config, q input.Queue, ops *ui.Ops, cs layout.Const { cs = st.Rigid() l := text.Label{ - Face: b.Face, - Text: b.Label, + Face: b.Face, + Text: b.Label, Alignment: b.Alignment, } ins := layout.UniformInset(ui.Dp(4)) @@ -257,15 +257,14 @@ func eventLoop() { var c1 layout.FlexChild // flex child for title bar face := faces.For(regular, ui.Sp(16)) - margin := layout.UniformInset(ui.Dp(10)) - title := &text.Label{Face: face, Text:"passgo"} + title := &text.Label{Face: face, Text: "passgo"} dotsbtn := &Button{ - Face: face, - Label: "\xe2\x8b\xae", - Alignment: text.End, - Color: black, + Face: face, + Label: "\xe2\x8b\xae", + Alignment: text.End, + Color: black, Background: gray, } @@ -281,9 +280,9 @@ func eventLoop() { _ = passSubmit pathnames := make([]string, 0) copied := &Overlay{Face: face, Text: "copied to clipboard", - Color: black, + Color: black, Background: darkgray, - Alignment: text.Middle, + Alignment: text.Middle, } var copiedWhen time.Time @@ -299,8 +298,8 @@ func eventLoop() { z = "/" } passBtns = append(passBtns, &Button{ - Face: face, - Label: strings.Join([]string{s, n, z}, ""), + Face: face, + Label: strings.Join([]string{s, n, z}, ""), Background: gray, }) pathnames = append(pathnames, x.Pathname) @@ -310,10 +309,10 @@ func eventLoop() { updateBtns() confBtn := &Button{ - Face: face, - Label: "configure", - Alignment: text.Middle, - Color: black, + Face: face, + Label: "configure", + Alignment: text.Middle, + Color: black, Background: gray, } @@ -321,10 +320,10 @@ func eventLoop() { storeDirEd := &text.Editor{Face: face, SingleLine: true} storeDirEd.SetText(store.Dir) saveBtn := &Button{ - Face: face, - Label: "save", - Alignment: text.End, - Color: black, + Face: face, + Label: "save", + Alignment: text.End, + Color: black, Background: gray, } @@ -353,7 +352,7 @@ func eventLoop() { if len(passBtns) == 0 { c2 = flex.End(confBtn.Layout(c, q, ops, cs)) if confBtn.Clicked() { - log(Info,"Configure") + log(Info, "Configure") w.Invalidate() page = confPage } @@ -433,7 +432,7 @@ func eventLoop() { passgo.GetStore(&store) Config.StoreDir = store.Dir saveConf() - reload <-struct{}{} + reload <- struct{}{} }() page = listPage }