From ce77568bd96e1af85999a75e6f79e89282fd1157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Thu, 29 Oct 2020 07:50:25 +0100 Subject: [PATCH] Add initial linux client --- .gitignore | 1 + linux/Makefile | 7 +++++++ linux/go.mod | 5 +++++ linux/go.sum | 2 ++ linux/main.go | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 linux/Makefile create mode 100644 linux/go.mod create mode 100644 linux/go.sum create mode 100644 linux/main.go diff --git a/.gitignore b/.gitignore index f45070bdf..0c0c54897 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ octo*.db .prettierrc.json mac/temp mac/dist +linux/octo-linux-app diff --git a/linux/Makefile b/linux/Makefile new file mode 100644 index 000000000..7e8d116ef --- /dev/null +++ b/linux/Makefile @@ -0,0 +1,7 @@ +.PHONY: run + +run: + go run ./main.go + +build: + go build -o octo-linux-app diff --git a/linux/go.mod b/linux/go.mod new file mode 100644 index 000000000..3c2fd0cbb --- /dev/null +++ b/linux/go.mod @@ -0,0 +1,5 @@ +module github.com/mattermost/mattermost-octo-tasks/linux + +go 1.15 + +require github.com/webview/webview v0.0.0-20200724072439-e0c01595b361 diff --git a/linux/go.sum b/linux/go.sum new file mode 100644 index 000000000..789e4a906 --- /dev/null +++ b/linux/go.sum @@ -0,0 +1,2 @@ +github.com/webview/webview v0.0.0-20200724072439-e0c01595b361 h1:e0+/fQY5l9NdCwPsEg9S8AgE5lFhZ/6UX+b2KkpIBFg= +github.com/webview/webview v0.0.0-20200724072439-e0c01595b361/go.mod h1:rpXAuuHgyEJb6kXcXldlkOjU6y4x+YcASKKXJNUhh0Y= diff --git a/linux/main.go b/linux/main.go new file mode 100644 index 000000000..f744697bc --- /dev/null +++ b/linux/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "log" + "os" + "os/exec" + "strconv" + + "github.com/webview/webview" +) + +func runOctoTasks() { + cmd := exec.Command("./bin/octoserver", "--monitorpid", strconv.FormatInt(int64(os.Getpid()), 10)) + cmd.Stdout = os.Stdout + err := cmd.Run() + if err != nil { + log.Fatal(err) + } + log.Printf("Just ran subprocess %d, exiting\n", cmd.Process.Pid) +} + +func main() { + os.Chdir("../") + debug := true + w := webview.New(debug) + defer w.Destroy() + go runOctoTasks() + + w.SetTitle("Octo Tasks") + w.SetSize(1024, 768, webview.HintNone) + w.Navigate("http://localhost:8000") + w.Run() +}