add: icon
This commit is contained in:
@@ -26,8 +26,8 @@
|
||||
- [x] 系统通知
|
||||
- [x] 清理历史
|
||||
- [x] 自动接收
|
||||
- [ ] 应用图标
|
||||
- [ ] 系统托盘(最小化到托盘)
|
||||
- [x] 应用图标
|
||||
- [ ] 系统托盘(最小化到托盘)徽章 https://github.com/wailsapp/wails/issues/4494
|
||||
- [ ] 收藏Peer
|
||||
- [ ] 多语言
|
||||
|
||||
|
||||
4
build.sh
Normal file
4
build.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
go-task linux:build
|
||||
go-task windows:build
|
||||
go-task linux:create:aur
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 24 KiB |
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=My Product
|
||||
Name=MeshDrop
|
||||
Comment=A mesh-drop application
|
||||
# The Exec line includes %u to pass the URL to the application
|
||||
Exec=/usr/local/bin/mesh-drop %u
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
name: "mesh-drop"
|
||||
arch: ${GOARCH}
|
||||
platform: "linux"
|
||||
version: "0.1.0"
|
||||
version: "0.0.3"
|
||||
section: "default"
|
||||
priority: "extra"
|
||||
maintainer: ${GIT_COMMITTER_NAME} <${GIT_COMMITTER_EMAIL}>
|
||||
description: "A mesh-drop application"
|
||||
vendor: "My Company"
|
||||
homepage: "https://wails.io"
|
||||
vendor: "nite"
|
||||
homepage: "https://www.nite07.com"
|
||||
license: "MIT"
|
||||
release: "1"
|
||||
|
||||
@@ -36,8 +36,8 @@ overrides:
|
||||
depends:
|
||||
- gtk3
|
||||
- webkit2gtk4.1
|
||||
|
||||
# Arch Linux packages (WebKit 4.1)
|
||||
|
||||
# Arch Linux packages (WebKit 4.1)
|
||||
archlinux:
|
||||
depends:
|
||||
- gtk3
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 25 KiB |
@@ -6,6 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Mesh Drop</title>
|
||||
<link rel="stylesheet" href="src/styles/style.css">
|
||||
<link rel="icon" type="image/svg+xml" href="src/assets/icon.svg">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
16
frontend/src/assets/icon.svg
Normal file
16
frontend/src/assets/icon.svg
Normal file
@@ -0,0 +1,16 @@
|
||||
<svg width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0" y="0" width="512" height="512" rx="100" ry="100" fill="#ffffff"/>
|
||||
|
||||
<g stroke="#0055ff" stroke-width="28" stroke-linecap="round" fill="none">
|
||||
|
||||
<circle cx="256" cy="256" r="28" fill="#0055ff" stroke="none"/>
|
||||
|
||||
<path d="M 190 200 A 70 70 0 0 0 190 312" />
|
||||
<path d="M 140 160 A 130 130 0 0 0 140 352" />
|
||||
<path d="M 90 120 A 190 190 0 0 0 90 392" />
|
||||
|
||||
<path d="M 322 200 A 70 70 0 0 1 322 312" />
|
||||
<path d="M 372 160 A 130 130 0 0 1 372 352" />
|
||||
<path d="M 422 120 A 190 190 0 0 1 422 392" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 633 B |
@@ -91,6 +91,12 @@ func Load() *Config {
|
||||
}
|
||||
}
|
||||
|
||||
// 确保默认保存路径存在
|
||||
err = os.MkdirAll(defaultSavePath, 0755)
|
||||
if err != nil {
|
||||
slog.Error("Failed to create default save path", "path", defaultSavePath, "error", err)
|
||||
}
|
||||
|
||||
var config Config
|
||||
if err := v.Unmarshal(&config); err != nil {
|
||||
slog.Error("Failed to unmarshal config", "error", err)
|
||||
|
||||
@@ -31,10 +31,6 @@ type Service struct {
|
||||
peersMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func init() {
|
||||
application.RegisterEvent[[]Peer]("peers:update")
|
||||
}
|
||||
|
||||
func NewService(config *config.Config, app *application.App, port int) *Service {
|
||||
return &Service{
|
||||
app: app,
|
||||
|
||||
@@ -59,10 +59,6 @@ func NewService(config *config.Config, app *application.App, notifier *notificat
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
application.RegisterEvent[application.Void]("transfer:refreshList")
|
||||
}
|
||||
|
||||
func (s *Service) GetPort() int {
|
||||
return s.port
|
||||
}
|
||||
|
||||
23
main.go
23
main.go
@@ -16,6 +16,9 @@ import (
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
//go:embed build/appicon.png
|
||||
var icon []byte
|
||||
|
||||
type FilesDroppedEvent struct {
|
||||
Files []string `json:"files"`
|
||||
Target string `json:"target"`
|
||||
@@ -32,15 +35,10 @@ func main() {
|
||||
SingleInstance: &application.SingleInstanceOptions{
|
||||
UniqueID: "com.nite07.mesh-drop",
|
||||
},
|
||||
Icon: icon,
|
||||
})
|
||||
|
||||
// 创建保存路径
|
||||
err := os.MkdirAll(conf.SavePath, 0755)
|
||||
if err != nil {
|
||||
slog.Error("Failed to create save path", "path", conf.SavePath, "error", err)
|
||||
}
|
||||
|
||||
// 通知
|
||||
// 初始化通知服务
|
||||
notifier := notifications.New()
|
||||
authorized, err := notifier.RequestNotificationAuthorization()
|
||||
if err != nil {
|
||||
@@ -94,7 +92,11 @@ func main() {
|
||||
})
|
||||
|
||||
// 窗口关闭事件
|
||||
window.OnWindowEvent(events.Common.WindowClosing, func(event *application.WindowEvent) {
|
||||
// window.OnWindowEvent(events.Common.WindowClosing, func(event *application.WindowEvent) {
|
||||
// })
|
||||
|
||||
// 应用关闭事件
|
||||
app.OnShutdown(func() {
|
||||
x, y := window.Position()
|
||||
width, height := window.Size()
|
||||
conf.SetWindowState(config.WindowState{
|
||||
@@ -116,13 +118,18 @@ func main() {
|
||||
}
|
||||
})
|
||||
|
||||
// 注册事件
|
||||
application.RegisterEvent[FilesDroppedEvent]("files-dropped")
|
||||
application.RegisterEvent[[]discovery.Peer]("peers:update")
|
||||
application.RegisterEvent[application.Void]("transfer:refreshList")
|
||||
|
||||
// 设置日志
|
||||
logger := slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
|
||||
Level: slog.LevelDebug,
|
||||
}))
|
||||
slog.SetDefault(logger)
|
||||
|
||||
// 运行应用
|
||||
err = app.Run()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
Reference in New Issue
Block a user