-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
74 lines (59 loc) · 1.81 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package main
import (
"embed"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
_ "github.com/mattn/go-sqlite3"
"comet/backend/db"
"comet/backend/events" // Import the events package
"comet/backend/menus"
"comet/backend/service"
)
//go:embed all:frontend/dist
var assets embed.FS
//go:embed migrations/*.sql
var embedMigrations embed.FS
func main() {
db.Init(embedMigrations)
app := application.New(application.Options{
Name: "Comet",
Description: "Desktop note taking app for nostr",
Services: []application.Service{
application.NewService(&service.AppService{}), // Add the AppService here
},
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
},
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
})
// Initialize the event system
events.Init(app)
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Comet",
Width: 1200,
Height: 600,
URL: "/",
MinWidth: 500,
MinHeight: 250,
Mac: application.MacWindow{
InvisibleTitleBarHeight: 50,
Backdrop: application.MacBackdropTranslucent,
TitleBar: application.MacTitleBarHiddenInsetUnified,
},
BackgroundColour: application.NewRGB(27, 38, 54),
})
createNoteMenu := menus.CreateNoteCardContextMenu(app)
createTrashNoteMenu := menus.CreateTrashNoteCardContextMenu(app)
createNotebookMenu := menus.CreateNotebookContextMenu(app)
createNoteFeedMenu := menus.CreateNoteFeedContextMenu(app)
app.RegisterContextMenu("note_card", createNoteMenu)
app.RegisterContextMenu("trash_note_card", createTrashNoteMenu)
app.RegisterContextMenu("notebook", createNotebookMenu)
app.RegisterContextMenu("note_feed", createNoteFeedMenu)
err := app.Run()
if err != nil {
log.Fatal(err)
}
}