Skip to content

Commit ef61cd2

Browse files
committed
wip
1 parent 7349279 commit ef61cd2

13 files changed

+83
-39
lines changed

.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: "sudo xcode-select -r"
2929
if: ${{ contains(matrix.os, 'macos') }}
3030
- name: Install Linux-specific packages
31-
run: "sudo apt install -y libwebkit2gtk-4.0-dev"
31+
run: "sudo apt install -y libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev"
3232
if: ${{ contains(matrix.os, 'ubuntu') }}
3333
- name: Check out code into the Go module directory
3434
uses: actions/checkout@v2

Makefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
GOOS:=$(shell go env GOOS)
22
GOARCH:=$(shell go env GOARCH)
33

4+
LDFLAGS:=
5+
6+
ifeq ($(OS),Windows_NT)
7+
LDFLAGS+=-H=windowsgui
8+
endif
9+
410
build:
5-
go build -o dist/$(GOOS)/$(GOARCH)/kopiaui .
11+
go build -ldflags "$(LDFLAGS)" -o dist/$(GOOS)/$(GOARCH)/kopiaui .
612

go.mod

+4-11
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,8 @@ module github.com/kopia/ui-shell
33
go 1.17
44

55
require (
6-
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect
7-
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 // indirect
8-
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 // indirect
9-
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 // indirect
10-
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 // indirect
11-
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f // indirect
12-
github.com/getlantern/systray v1.1.0 // indirect
13-
github.com/go-stack/stack v1.8.0 // indirect
14-
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
15-
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e // indirect
16-
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9 // indirect
6+
github.com/kermieisinthehouse/systray v1.2.3
7+
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e
178
)
9+
10+
require golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect

go.sum

+5-24
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
1-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2-
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4=
3-
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY=
4-
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 h1:6uJ+sZ/e03gkbqZ0kUG6mfKoqDb4XMAzMIwlajq19So=
5-
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A=
6-
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 h1:guBYzEaLz0Vfc/jv0czrr2z7qyzTOGC9hiQ0VC+hKjk=
7-
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7/go.mod h1:zx/1xUUeYPy3Pcmet8OSXLbF47l+3y6hIPpyLWoR9oc=
8-
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 h1:micT5vkcr9tOVk1FiH8SWKID8ultN44Z+yzd2y/Vyb0=
9-
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7/go.mod h1:dD3CgOrwlzca8ed61CsZouQS5h5jIzkK9ZWrTcf0s+o=
10-
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 h1:XYzSdCbkzOC0FDNrgJqGRo8PCMFOBFL9py72DRs7bmc=
11-
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA=
12-
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f h1:wrYrQttPS8FHIRSlsrcuKazukx/xqO/PpLZzZXsF+EA=
13-
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA=
14-
github.com/getlantern/systray v1.1.0 h1:U0wCEqseLi2ok1fE6b88gJklzriavPJixZysZPkZd/Y=
15-
github.com/getlantern/systray v1.1.0/go.mod h1:AecygODWIsBquJCJFop8MEQcJbWFfw/1yWbVabNgpCM=
16-
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
17-
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
18-
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
19-
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
20-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
21-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
22-
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
1+
github.com/kermieisinthehouse/systray v1.2.3 h1:tawLahcam/Ccs/F2n6EOQo8qJnSTD2hLzOYqTGsUsbA=
2+
github.com/kermieisinthehouse/systray v1.2.3/go.mod h1:axh6C/jNuSyC0QGtidZJURc9h+h41HNoMySoLVrhVR4=
3+
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
234
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e h1:z780M7mCrdt6KiICeW9SGirvQjxDlrVU+n99FO93nbI=
245
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e/go.mod h1:rpXAuuHgyEJb6kXcXldlkOjU6y4x+YcASKKXJNUhh0Y=
25-
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9 h1:YTzHMGlqJu67/uEo1lBv0n3wBXhXNeUbB1XfN2vmTm0=
26-
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
6+
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
7+
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

icons/icons.go

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package icons exposes embedded platform-specific icons.
2+
package icons

icons/icons_darwin.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package icons
2+
3+
import (
4+
_ "embed"
5+
)
6+
7+
//go:embed tray.png
8+
var TrayIcon []byte

icons/icons_linux.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package icons
2+
3+
import (
4+
_ "embed"
5+
)
6+
7+
//go:embed tray.png
8+
var TrayIcon []byte

icons/icons_windows.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package icons
2+
3+
import (
4+
_ "embed"
5+
)
6+
7+
//go:embed tray.ico
8+
var TrayIcon []byte

icons/kopia-flat-512.icns

59.4 KB
Binary file not shown.

icons/kopia-flat.icns

Whitespace-only changes.

icons/tray.ico

56.9 KB
Binary file not shown.

icons/tray.png

28.1 KB
Loading

main.go

+40-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,45 @@
11
package main
22

3-
import "github.com/kopia/ui-shell/app"
3+
import (
4+
"github.com/kermieisinthehouse/systray"
5+
"github.com/kopia/ui-shell/icons"
6+
)
47

58
func main() {
6-
app.Run()
9+
systray.Run(onReady, onExit)
10+
}
11+
12+
func onReady() {
13+
systray.SetIcon(icons.TrayIcon)
14+
15+
//systray.SetTitle("KopiaUI")
16+
systray.SetTooltip("KopiaUI")
17+
systray.AddMenuItem("<starting up>", "Starting up...")
18+
systray.AddMenuItem("<starting up>", "Starting up...")
19+
systray.AddSeparator()
20+
systray.AddMenuItem("Connect To Another Repository...", "")
21+
systray.AddSeparator()
22+
mLaunchAtStartup := systray.AddMenuItemCheckbox("Launch At Startup", "Automatically launch at startup", false)
23+
mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
24+
25+
go func() {
26+
for {
27+
select {
28+
case <-mQuit.ClickedCh:
29+
systray.Quit()
30+
return
31+
32+
case <-mLaunchAtStartup.ClickedCh:
33+
if mLaunchAtStartup.Checked() {
34+
mLaunchAtStartup.Uncheck()
35+
} else {
36+
mLaunchAtStartup.Check()
37+
}
38+
}
39+
}
40+
}()
41+
}
42+
43+
func onExit() {
44+
// clean up here
745
}

0 commit comments

Comments
 (0)