From 3aad93e7e8bc9d208c8b675c5229b0d6c82f15d7 Mon Sep 17 00:00:00 2001 From: mamamiyear Date: Tue, 7 Jul 2026 16:37:47 +0800 Subject: [PATCH] feat: copy saved file path to clipboard after local save After writing the screenshot to disk, copy its path to the clipboard so it can be pasted immediately, matching the upload and summary flows. The save status now shows the copied path. A clipboard error does not fail the save itself. --- app.go | 2 +- internal/application/capture_actions.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index b3607f4..36a5c7e 100644 --- a/app.go +++ b/app.go @@ -343,7 +343,7 @@ func (a *App) runSaveImagePipeline(pngBytes []byte, dir string) (string, error) wruntime.EventsEmit(a.ctx, "upload:failure", err.Error()) return "", err } - a.emitOperationStatus("save", "保存完成", path, "success") + a.emitOperationStatus("save", "保存完成", "文件路径已复制到剪贴板:"+path, "success") wruntime.EventsEmit(a.ctx, "upload:success", path) return path, nil } diff --git a/internal/application/capture_actions.go b/internal/application/capture_actions.go index 2c63021..059b61c 100644 --- a/internal/application/capture_actions.go +++ b/internal/application/capture_actions.go @@ -61,6 +61,14 @@ func (s *CaptureActionsService) SaveImage(_ context.Context, pngBytes []byte, di s.notifyFailure("save failed: " + err.Error()) return "", err } + // Copy the saved path to the clipboard so the user can paste it right + // away, mirroring how the upload/summary flows copy their result. A + // clipboard failure must not fail the save itself. + if s.Clipboard != nil { + if err := s.Clipboard.WriteText(path); err != nil { + s.notifyFailure("clipboard write failed: " + err.Error()) + } + } if s.Notifier != nil { s.Notifier.NotifySuccess(path) }