Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions cmd/awl-tray/tray.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
_ "embed"
"fmt"
"image"
"path/filepath"
"runtime"
"slices"
"sort"
Expand Down Expand Up @@ -130,6 +131,14 @@ func initTray() {
}
}()

advancedMenu := systray.AddMenuItem("Advanced", "")
editConfigMenu := advancedMenu.AddSubMenuItem("Edit raw config", "Open config file in default editor")
go func() {
for range editConfigMenu.ClickedCh {
onClickEditRawConfig()
}
}()

systray.AddSeparator()
mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
go func() {
Expand Down Expand Up @@ -300,6 +309,23 @@ func refreshProxySubmenus() {
}
}

func onClickEditRawConfig() {
if app != nil {
ok := showQuestionDialog("Anywherelan", "Server is currently running.\nYou need to stop the server before editing the config,\notherwise your changes will be overwritten.\n\nStop the server now?", "Stop server")
if !ok {
return
}
StopServer()
}

configPath := filepath.Join(config.CalcAppDataDir(), config.AppConfigFilename)
err := openURL(configPath)
if err != nil {
logger.Errorf("failed to open config file %s: %v", configPath, err)
showErrorDialog("Anywherelan error", fmt.Sprintf("Failed to open config file %s: %v", configPath, err))
}
}

func onClickUpdateMenu() error {
updateMenu.SetTitle("Checking...")
updateMenu.Disable()
Expand Down
Loading