Remove redundant calls setting linuxClipboardTool. getUserLinuxClipboardTool() now handles the caching internally (#17320)

This commit is contained in:
Jacob Richman
2026-01-22 10:11:56 -08:00
committed by GitHub
parent 6d7423263b
commit 1320ebceb9
+6 -5
View File
@@ -163,10 +163,10 @@ async function checkXclipForImage() {
*/ */
export async function clipboardHasImage(): Promise<boolean> { export async function clipboardHasImage(): Promise<boolean> {
if (process.platform === 'linux') { if (process.platform === 'linux') {
linuxClipboardTool = getUserLinuxClipboardTool(); const tool = getUserLinuxClipboardTool();
if (linuxClipboardTool === 'wl-paste') { if (tool === 'wl-paste') {
if (await checkWlPasteForImage()) return true; if (await checkWlPasteForImage()) return true;
} else if (linuxClipboardTool === 'xclip') { } else if (tool === 'xclip') {
if (await checkXclipForImage()) return true; if (await checkXclipForImage()) return true;
} }
return false; return false;
@@ -264,12 +264,13 @@ export async function saveClipboardImage(
if (process.platform === 'linux') { if (process.platform === 'linux') {
const tempFilePath = path.join(tempDir, `clipboard-${timestamp}.png`); const tempFilePath = path.join(tempDir, `clipboard-${timestamp}.png`);
const tool = getUserLinuxClipboardTool();
if (linuxClipboardTool === 'wl-paste') { if (tool === 'wl-paste') {
if (await saveFileWithWlPaste(tempFilePath)) return tempFilePath; if (await saveFileWithWlPaste(tempFilePath)) return tempFilePath;
return null; return null;
} }
if (linuxClipboardTool === 'xclip') { if (tool === 'xclip') {
if (await saveFileWithXclip(tempFilePath)) return tempFilePath; if (await saveFileWithXclip(tempFilePath)) return tempFilePath;
return null; return null;
} }