chore: 初始化仓库(零源工具箱 0.1.0 基线)
- Go 主进程 cmd/zerorigin(托盘常驻 + 触发器/规则/动作引擎) - Wails v3 设置进程 cmd/settings(独立 module) - 监督进程 cmd/watchdog(-supervise 异常重启) - 构建脚本 build.bat / NSIS 安装包 deploy/、便携版 portable/ - 架构与 MVP 计划文档 docs/、阶段 0-4 验收记录 deploy/acceptance-0-4.md
This commit is contained in:
commit
0a1c1e82ea
188 files changed
+19926
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package action
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
pwin "zerorigin/internal/platform/windows"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Register("show_notification", func() Action { return ¬ificationAction{} })
|
||||
}
|
||||
|
||||
// notificationAction 显示系统托盘气泡通知。
|
||||
type notificationAction struct{}
|
||||
|
||||
func (a *notificationAction) ID() string { return "show_notification" }
|
||||
func (a *notificationAction) Name() string { return "显示通知" }
|
||||
|
||||
func (a *notificationAction) Schema() ActionSchema {
|
||||
return ActionSchema{Params: []ParamSpec{
|
||||
{Name: "title", Type: "string", Required: true},
|
||||
{Name: "text", Type: "string", Required: true},
|
||||
}}
|
||||
}
|
||||
|
||||
func (a *notificationAction) Validate(params map[string]any) error {
|
||||
if GetString(params, "title") == "" {
|
||||
return fmt.Errorf("show_notification: missing param \"title\"")
|
||||
}
|
||||
if GetString(params, "text") == "" {
|
||||
return fmt.Errorf("show_notification: missing param \"text\"")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *notificationAction) Execute(ctx context.Context, params map[string]any) error {
|
||||
return pwin.ShowBalloon(GetString(params, "title"), GetString(params, "text"))
|
||||
}
|
||||
Reference in new issue
Block a user