Skip to content

Commit 2bec9d8

Browse files
committed
add a menu in the tray menu to open the config file fix #734
1 parent a5861be commit 2bec9d8

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

main.go

+1
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ func loop() {
257257
if err != nil {
258258
log.Panicf("cannot parse arguments: %s", err)
259259
}
260+
Systray.SetConfig(configPath)
260261

261262
// Parse additional ini config if defined
262263
if len(*additionalConfig) > 0 {

systray/systray.go

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"os/exec"
2222
"strings"
2323

24+
"github.com/arduino/go-paths-helper"
2425
log "github.com/sirupsen/logrus"
2526
)
2627

@@ -36,6 +37,8 @@ type Systray struct {
3637
AdditionalConfig string
3738
// The path of the exe (only used in update)
3839
path string
40+
// The path of the configuration file
41+
configPath *paths.Path
3942
}
4043

4144
// Restart restarts the program
@@ -92,3 +95,7 @@ func (s *Systray) Update(path string) {
9295
s.path = path
9396
s.Restart()
9497
}
98+
99+
func (s *Systray) SetConfig(configPath *paths.Path) {
100+
s.configPath = configPath
101+
}

systray/systray_real.go

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func (s *Systray) start() {
5757
// Add links
5858
mURL := systray.AddMenuItem("Go to Arduino Create", "Arduino Create")
5959
mDebug := systray.AddMenuItem("Open Debug Console", "Debug console")
60+
mConfig := systray.AddMenuItem("Open Configuration", "Config File")
6061

6162
// Remove crash-reports
6263
mRmCrashes := systray.AddMenuItem("Remove crash reports", "")
@@ -78,6 +79,8 @@ func (s *Systray) start() {
7879
_ = open.Start("https://create.arduino.cc")
7980
case <-mDebug.ClickedCh:
8081
_ = open.Start(s.DebugURL())
82+
case <-mConfig.ClickedCh:
83+
_ = open.Start(s.configPath.String())
8184
case <-mRmCrashes.ClickedCh:
8285
s.RemoveCrashes()
8386
s.updateMenuItem(mRmCrashes, s.CrashesIsEmpty())

0 commit comments

Comments
 (0)