Skip to content

Commit

Permalink
fix open config, exit and restart app
Browse files Browse the repository at this point in the history
  • Loading branch information
ad committed Jan 24, 2024
1 parent 0bed962 commit 41d9ec3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
Binary file modified build/FindMy ticker.app/Contents/MacOS/findmyticker
Binary file not shown.
22 changes: 1 addition & 21 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"flag"
"fmt"
"io"
"log"
"os"
"os/exec"
"os/user"
Expand Down Expand Up @@ -139,26 +138,7 @@ func OpenConfigEditor() error {
w.Flush()
}

cmd := exec.Command(`open`, "-e", path)
stderr, err := cmd.StderrPipe()
log.SetOutput(os.Stderr)

if err != nil {
log.Fatal(err)
}

if err := cmd.Start(); err != nil {
log.Fatal(err)
}

slurp, _ := io.ReadAll(stderr)
fmt.Printf("%s\n", slurp)

if err := cmd.Wait(); err != nil {
log.Fatal(err)
}

return nil
return exec.Command(`open`, "-e", path).Run()
}

func GetConfigPath() (string, error) {
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
var (
cancel context.CancelFunc

version = `0.1.5`
version = `0.1.6`

menuInfo *systray.MenuItem
menuError *systray.MenuItem
Expand Down Expand Up @@ -97,7 +97,6 @@ func onReady() {
case <-mConfig.ClickedCh:
fmt.Println("Opening config editor")
_ = OpenConfig()
return
case <-mQuit.ClickedCh:
fmt.Println("Requesting quit")
systray.Quit()
Expand All @@ -122,6 +121,8 @@ func Restart() error {
return error
}

systray.Quit()

return nil
}

Expand Down

0 comments on commit 41d9ec3

Please sign in to comment.