Created
February 13, 2023 00:16
-
-
Save Ambushfall/444bb14ca4b5268ea855cec8431b7dfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Menu: Clipboard History | |
// Description: Copy something from the clipboard history | |
// Shortcut: command shift v | |
import "@johnlindquist/kit" | |
let { history } = await db("clipboard-history") | |
let { value, type } = await arg("What to paste?", () => { | |
return history.map(({ value, type, timestamp, secret }) => { | |
return { | |
type, | |
name: secret ? value.slice(0, 4).padEnd(10, "*") : value, | |
value: { | |
value, | |
type, | |
}, | |
description: timestamp, | |
preview: | |
type === "image" | |
? md(`![timestamp](${value})`) | |
: value.includes("\n") | |
? `<div class="font-mono text-xs">${value | |
.split("\n") | |
.map((line) => `<p>${line}</p>`) | |
.join("")}<div>` | |
: null, | |
} | |
}) | |
}) | |
if (type === "image") { | |
await copyPathAsImage(value) | |
await keystroke("command v") | |
} | |
if (type === "text") { | |
await setSelectedText(value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment