-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
48 lines (43 loc) · 1.09 KB
/
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
44
45
46
47
48
package main
import (
_ "image/jpeg"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/data/binding"
"github.com/go-gl/glfw/v3.3/glfw"
)
func main() {
ScreenWidth, ScreenHeight = getDisplayResolution()
a = &App{App: app.New()}
a.loadState()
if a.state.Theme == "dark" {
a.SetIcon(appIconDark)
} else {
a.SetIcon(appIconLight)
}
a.topWindow = a.NewWindow(a.Metadata().Name)
a.topWindowTitle = binding.NewString()
a.topWindowTitle.AddListener(binding.NewDataListener(func() {
path, _ := a.topWindowTitle.Get()
a.topWindow.SetTitle(a.Metadata().Name + ": " + path)
}))
a.newShortcuts()
a.enableShortcuts()
a.Settings().SetTheme(&Theme{})
a.topWindowTitle.Set(rootURI.Path())
a.topWindow.SetOnClosed(a.saveState)
a.topWindow.SetMaster()
a.topWindow.Resize(a.state.WindowSize)
go func() {
a.newPhotoList()
a.newLayout()
}()
a.topWindow.CenterOnScreen()
a.topWindow.Show()
a.Run()
}
func getDisplayResolution() (float32, float32) {
glfw.Init()
defer glfw.Terminate()
monitor := glfw.GetPrimaryMonitor()
return float32(monitor.GetVideoMode().Width), float32(monitor.GetVideoMode().Height)
}