feat(app): implement basic function

General
- 配置界面支持配置对象存储桶
- 快捷键进入截图
- 一键上传截图 & 复制截图链接

MacOS
- 状态栏指示器和应用图标
This commit is contained in:
2026-05-17 15:51:02 +08:00
parent 6c00bf5a6f
commit ceecbb6af4
84 changed files with 7160 additions and 4 deletions
+12
View File
@@ -0,0 +1,12 @@
// Package cursor exposes the current mouse pointer position in a
// platform-agnostic way. We use it to anchor the post-capture toolbar near
// the location where the user released the mouse — on macOS that point is
// effectively the bottom-right corner of the screencapture selection.
package cursor
// Point is a screen-space pointer location, in *logical* pixels (i.e. the
// coordinate system Wails uses for window placement).
type Point struct {
X int
Y int
}
@@ -0,0 +1,30 @@
//go:build darwin
// cursor_darwin.go reads the global cursor position via Quartz Event
// Services. This API is preferable to NSEvent.mouseLocation for our use
// case because it returns the pointer in flipped (top-left origin)
// coordinates, which matches Wails / web pixel coordinates exactly.
package cursor
/*
#cgo LDFLAGS: -framework ApplicationServices
#include <ApplicationServices/ApplicationServices.h>
// readCursor returns the current mouse position with origin at the
// top-left of the primary display, in logical pixels.
static void readCursor(double* x, double* y) {
CGEventRef event = CGEventCreate(NULL);
CGPoint p = CGEventGetLocation(event);
if (event) CFRelease(event);
*x = p.x;
*y = p.y;
}
*/
import "C"
// Get returns the current mouse pointer position.
func Get() (Point, error) {
var x, y C.double
C.readCursor(&x, &y)
return Point{X: int(x), Y: int(y)}, nil
}
@@ -0,0 +1,9 @@
//go:build !darwin
package cursor
// Get is a no-op stub on non-macOS targets. The toolbar will fall back to
// the centre of the screen on these platforms.
func Get() (Point, error) {
return Point{X: 0, Y: 0}, nil
}