From bfd0eeca2536541a6de853f73eeee048a58ecfb1 Mon Sep 17 00:00:00 2001 From: shylinux Date: Mon, 3 Jan 2022 22:59:49 +0800 Subject: [PATCH] add app --- Makefile | 6 +++++- src/app.go | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/app.go diff --git a/Makefile b/Makefile index 1b309532..0e3a77f1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ export GOPROXY=https://goproxy.cn,direct export GOPRIVATE=shylinux.com,github.com -export CGO_ENABLED=0 +# export CGO_ENABLED=0 all: @echo && date @@ -14,3 +14,7 @@ all: ice: cat src/binpack.go|sed 's/package main/package ice/g' > usr/release/binpack.go +macapp: + mkdir -p usr/publish/contexts.app/Contents/MacOS + go build -o usr/publish/contexts.app/Contents/MacOS/contexts src/app.go src/binpack.go + open usr/publish/contexts.app diff --git a/src/app.go b/src/app.go new file mode 100644 index 00000000..869a1d20 --- /dev/null +++ b/src/app.go @@ -0,0 +1,25 @@ +package main + +import ( + "os" + "path" + "time" + + "github.com/webview/webview" + "shylinux.com/x/ice" + _ "shylinux.com/x/icebergs/misc/app" +) + +func main() { + os.Chdir(path.Join("/Users", os.Getenv("USER"), "contexts")) + go ice.Run("serve", "start", "dev", "shy") + time.Sleep(time.Second) + + w := webview.New(true) + defer w.Destroy() + + w.SetTitle("contexts") + w.SetSize(800, 600, webview.HintNone) + w.Navigate("http://localhost:9020") + w.Run() +}