From 22378c001ef3214363238c276c792ca8f86e7b56 Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Sun, 8 Mar 2026 21:53:36 +1100 Subject: [PATCH] stuff --- cinny | 2 +- electron/main.js | 31 ++++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/cinny b/cinny index b185e0b..30a7725 160000 --- a/cinny +++ b/cinny @@ -1 +1 @@ -Subproject commit b185e0b129ec560ad271c5ec3e40fe8dffc48a13 +Subproject commit 30a77257695e60d0e0b44ed9c2d547cc1ae1c9cc diff --git a/electron/main.js b/electron/main.js index 00f8099..477ecab 100644 --- a/electron/main.js +++ b/electron/main.js @@ -326,12 +326,12 @@ function createWindow() { } }, { useSystemPicker: false }); - // Disable default context menu, only show for text selection + // Disable default context menu, only show for text selection and images mainWindow.webContents.on('context-menu', (event, params) => { - const { selectionText, isEditable } = params; + const { selectionText, isEditable, mediaType, srcURL } = params; - // Only show context menu if there's selected text or in an editable field - if (selectionText || isEditable) { + // Show context menu for text selection, editable fields, or images + if (selectionText || isEditable || mediaType === 'image') { // Build a minimal menu for text operations const template = []; @@ -348,6 +348,27 @@ function createWindow() { } } + // Image context menu options + if (mediaType === 'image' && srcURL) { + template.push( + { + label: 'Copy Image', + click: () => { + mainWindow.webContents.copyImageAt(params.x, params.y); + } + }, + { + label: 'Save Image As...', + click: () => { + mainWindow.webContents.downloadURL(srcURL); + } + } + ); + if (selectionText) { + template.push({ type: 'separator' }); + } + } + if (selectionText) { template.push( { @@ -392,7 +413,7 @@ function createWindow() { menu.popup(mainWindow); } } - // If no text selected and not editable, suppress the context menu entirely + // If no text selected, not editable, and not an image, suppress the context menu entirely }); // Load the app