-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
43 lines (38 loc) · 923 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/driver/desktop"
"fyne.io/systray"
"go-scrcpy-client/ui"
"os"
)
func main() {
App := app.NewWithID(ui.AppName)
mainWindow := App.NewWindow(ui.AppName)
App.SetIcon(ui.Logo)
ui.MainWindow(mainWindow)
if desk, ok := App.(desktop.App); ok {
ui.SetupSystray(desk, mainWindow)
}
mainWindow.Resize(fyne.Size{Width: ui.Width, Height: ui.Height})
mainWindow.SetFixedSize(true)
mainWindow.CenterOnScreen()
mainWindow.SetIcon(ui.Logo)
// setting intercept not to close app, but hide window,
// and close only via tray
mainWindow.SetCloseIntercept(func() {
ui.Notification(ui.AppName, fmt.Sprintf("%s minimized!", ui.AppName))
mainWindow.Hide()
})
mainWindow.Show()
App.Lifecycle().SetOnStarted(func() {
systray.SetTooltip(ui.AppName)
})
App.Run()
err := os.Unsetenv("FYNE_FONT")
if err != nil {
return
}
}