Initial commit: a Copper-style panel for prompts and photos
Keeps text prompts and photos in a floating always-on-top panel and
copies them back to the clipboard on click. Double-Shift captures the
selection from any app; sections, search, copy-as-list, merge, and
local JSON persistence mirror shadcn's Copper workflow.
💘 Generated with Crush
Assisted-by: Crush:kimi-k3
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import AppKit
|
||||
|
||||
let size = NSSize(width: 1024, height: 1024)
|
||||
guard let rep = NSBitmapImageRep(
|
||||
bitmapDataPlanes: nil, pixelsWide: 1024, pixelsHigh: 1024,
|
||||
bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true, isPlanar: false,
|
||||
colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0
|
||||
) else { exit(1) }
|
||||
|
||||
NSGraphicsContext.saveGraphicsState()
|
||||
NSGraphicsContext.current = NSGraphicsContext(bitmapImageRep: rep)
|
||||
NSGraphicsContext.current?.imageInterpolation = .high
|
||||
|
||||
// Dark rounded tile.
|
||||
let tile = NSBezierPath(roundedRect: NSRect(x: 112, y: 112, width: 800, height: 800), xRadius: 180, yRadius: 180)
|
||||
let gradient = NSGradient(colors: [
|
||||
NSColor(calibratedRed: 0.16, green: 0.17, blue: 0.22, alpha: 1),
|
||||
NSColor(calibratedRed: 0.07, green: 0.08, blue: 0.11, alpha: 1),
|
||||
])!
|
||||
gradient.draw(in: tile, angle: -90)
|
||||
|
||||
// Terminal-style prompt glyph: chevron + cursor block.
|
||||
NSColor(calibratedRed: 0.40, green: 0.85, blue: 0.55, alpha: 1).setStroke()
|
||||
let chevron = NSBezierPath()
|
||||
chevron.move(to: NSPoint(x: 300, y: 640))
|
||||
chevron.line(to: NSPoint(x: 470, y: 512))
|
||||
chevron.line(to: NSPoint(x: 300, y: 384))
|
||||
chevron.lineWidth = 74
|
||||
chevron.lineCapStyle = .round
|
||||
chevron.lineJoinStyle = .round
|
||||
chevron.stroke()
|
||||
|
||||
NSColor(calibratedRed: 0.40, green: 0.85, blue: 0.55, alpha: 1).setFill()
|
||||
let cursor = NSBezierPath(roundedRect: NSRect(x: 560, y: 384, width: 150, height: 84), xRadius: 16, yRadius: 16)
|
||||
cursor.fill()
|
||||
|
||||
NSGraphicsContext.restoreGraphicsState()
|
||||
|
||||
guard let data = rep.representation(using: .png, properties: [:]) else { exit(1) }
|
||||
if CommandLine.arguments.count < 2 { exit(1) }
|
||||
do {
|
||||
try data.write(to: URL(fileURLWithPath: CommandLine.arguments[1]))
|
||||
} catch {
|
||||
exit(1)
|
||||
}
|
||||
Reference in New Issue
Block a user