From 2969af132ff9658c8a8ff09ffcb0d58cb1b2945c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 30 Jun 2026 17:19:50 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Allow=20directly=20pasting=20the=20?= =?UTF-8?q?gitmoji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 9 +++++++++ src/gitmoji.tsx | 36 ++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 47a4407..737c1d2 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,15 @@ { "title": "Gitmoji Code", "value": "code" } ], "default": "emoji" + }, + { + "name": "directPaste", + "title": "Direct Paste", + "description": "Paste the gitmoji directly into the focused app instead of copying to the clipboard.", + "required": false, + "type": "checkbox", + "label": "Paste directly into the focused app", + "default": false } ], "scripts": { diff --git a/src/gitmoji.tsx b/src/gitmoji.tsx index abbdc99..31d7edf 100644 --- a/src/gitmoji.tsx +++ b/src/gitmoji.tsx @@ -20,6 +20,7 @@ type CopyFormat = "emoji" | "code"; type GitmojiPreferences = { copyFormat?: CopyFormat; + directPaste?: boolean; }; const gitmojis = gitmojisData.gitmojis as Gitmoji[]; @@ -30,10 +31,11 @@ const contentFor = (gitmoji: Gitmoji, format: CopyFormat) => format === "code" ? gitmoji.code : gitmoji.emoji; export default function GitmojiList() { - const { copyFormat } = getPreferenceValues(); + const { copyFormat, directPaste } = getPreferenceValues(); const primaryFormat: CopyFormat = copyFormat === "code" ? "code" : "emoji"; const secondaryFormat: CopyFormat = primaryFormat === "code" ? "emoji" : "code"; + const preferPaste = directPaste === true; return ( @@ -47,17 +49,27 @@ export default function GitmojiList() { keywords={[gitmoji.name]} actions={ - - showToast( - Toast.Style.Success, - "Copied to clipboard", - String(content), - ) - } - /> + {preferPaste ? ( + + showToast(Toast.Style.Success, "Pasted", String(content)) + } + /> + ) : ( + + showToast( + Toast.Style.Success, + "Copied to clipboard", + String(content), + ) + } + /> + )}