Skip to content

Commit 3e5035e

Browse files
committed
Merge branch 'master' of https://github.com/fexaop/whats4linux
2 parents c56960b + d64e912 commit 3e5035e

11 files changed

Lines changed: 57 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ frontend/wailsjs
55
.DS_Store
66
.env
77
whats4linux
8+
whats4linux_tray
89
wa.db
910
wa.db.1
1011
vendor
@@ -13,3 +14,4 @@ systray/systray
1314
result
1415
.pkg-config-wrapped
1516
.wails-wrapped
17+
*.AppImage

api/api.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,18 @@ func (a *Api) Startup(ctx context.Context) {
5454
if err != nil {
5555
panic(err)
5656
}
57-
// start systray
5857
go func() {
5958
err := a.us.ListenAndServe()
6059
if err != nil {
6160
log.Println("Unix socket server error:", err)
6261
}
6362
}()
6463

64+
err = misc.StartSystray()
65+
if err != nil {
66+
panic(err)
67+
}
68+
6569
a.ctx = ctx
6670
dbLog := waLog.Stdout("Database", settings.GetLogLevel(), true)
6771
a.cw, err = wa.NewAppDatabase(ctx)

internal/misc/systray_linux.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//go:build linux
2+
// +build linux
3+
4+
package misc
5+
6+
import (
7+
"fmt"
8+
"os"
9+
"os/exec"
10+
"path/filepath"
11+
)
12+
13+
func StartSystray() error {
14+
appDir := os.Getenv("APPDIR")
15+
if appDir == "" {
16+
return fmt.Errorf("APPDIR not set")
17+
}
18+
19+
trayPath := filepath.Join(appDir, "usr", "bin", "whats4linux_tray")
20+
21+
cmd := exec.Command(trayPath)
22+
cmd.Stdout = os.Stdout
23+
cmd.Stderr = os.Stderr
24+
25+
return cmd.Start()
26+
}

internal/misc/systray_windows.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//go:build !linux
2+
// +build !linux
3+
4+
package misc
5+
6+
import "log"
7+
8+
func StartSystray() error {
9+
log.Println("Systray is not supported on this platform")
10+
return nil
11+
}

packaging/AppImage/AppDir/.DirIcon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
whats4linux.png

packaging/AppImage/AppDir/AppRun

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
HERE="$(dirname "$(readlink -f "$0")")"
3+
exec "$HERE/usr/bin/whats4linux" "$@"

packaging/AppImage/AppDir/usr/bin/.gitkeep

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=Whats4Linux
4+
Exec=whats4linux
5+
Icon=whats4linux
6+
Terminal=false
7+
Categories=Network;
31.9 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./usr/share/applications/whats4linux.desktop

0 commit comments

Comments
 (0)