Only reims-go.exe ships now; reims-go-cli.exe is gone. Without arguments it opens the window, with a command it runs command-line mode (cmd/reims-go moved to internal/cli). Missing standard handles are attached to the parent console; handles the caller passes in (pipes, files) are kept, so scripts and agents get output and exit codes. `vm start` hands the VM to the window process so it gets Guest Tools and the Win10 cold-reboot watcher, which a command that exits could not run: - a running window gets the request through Wails' single-instance protocol and stays hidden; - otherwise the command launches the window tray-only (--background), detached from the caller's console and handles; - the window writes the outcome, with the VM's last log lines on failure, to <DataRoot>\tmp\cli-start-*.json (it accepts no other path) and the command reports it. With --data-root the VM still starts in the command itself. The window now takes a single-instance lock: a second double-click brings the running window forward. `wails dev` builds use their own lock name. Tested on Win10 19045 with macos-tahoe: start from the command line with no window running (4 s, exit 0) and with one running (3 s, exit 0, same process); the cold-reboot monitor was held by the window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70 lines
1.6 KiB
Go
70 lines
1.6 KiB
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"os"
|
|
|
|
"github.com/Nwflower/reims-go/internal/cli"
|
|
|
|
"github.com/wailsapp/wails/v2"
|
|
"github.com/wailsapp/wails/v2/pkg/options"
|
|
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
|
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
|
)
|
|
|
|
//go:embed all:frontend/dist
|
|
var assets embed.FS
|
|
|
|
//go:embed assets/logo.png
|
|
var trayIconPNG []byte
|
|
|
|
func main() {
|
|
args := os.Args[1:]
|
|
if cli.IsCommand(args) {
|
|
attachConsole()
|
|
os.Exit(cli.Main(args))
|
|
}
|
|
launch, _ := cli.ParseWindowArgs(args)
|
|
|
|
app := NewApp()
|
|
app.launch = launch
|
|
err := wails.Run(&options.App{
|
|
Title: "Reims-Go",
|
|
StartHidden: launch.Background,
|
|
// One window per user. A second launch — double-click, or `reims-go vm
|
|
// start` handing a VM over — goes to the running one instead.
|
|
SingleInstanceLock: &options.SingleInstanceLock{
|
|
UniqueId: cli.InstanceID,
|
|
OnSecondInstanceLaunch: app.onSecondInstance,
|
|
},
|
|
Width: 1120,
|
|
Height: 740,
|
|
MinWidth: 920,
|
|
MinHeight: 600,
|
|
Frameless: true,
|
|
AssetServer: &assetserver.Options{
|
|
Assets: assets,
|
|
},
|
|
BackgroundColour: &options.RGBA{R: 28, G: 28, B: 30, A: 255},
|
|
Windows: &windows.Options{
|
|
Theme: windows.Dark,
|
|
WebviewIsTransparent: false,
|
|
WindowIsTranslucent: false,
|
|
CustomTheme: &windows.ThemeSettings{
|
|
DarkModeTitleBar: windows.RGB(28, 28, 30),
|
|
DarkModeTitleText: windows.RGB(245, 245, 247),
|
|
DarkModeBorder: windows.RGB(58, 58, 62),
|
|
},
|
|
},
|
|
OnStartup: app.startup,
|
|
OnBeforeClose: app.beforeClose,
|
|
OnShutdown: app.shutdown,
|
|
Bind: []any{
|
|
app,
|
|
},
|
|
})
|
|
if err != nil {
|
|
println("Error:", err.Error())
|
|
}
|
|
}
|