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

View File

@@ -163,10 +163,10 @@ async function checkXclipForImage() {
*/
export async function clipboardHasImage(): Promise<boolean> {
if (process.platform === 'linux') {
linuxClipboardTool = getUserLinuxClipboardTool();
if (linuxClipboardTool === 'wl-paste') {
const tool = getUserLinuxClipboardTool();
if (tool === 'wl-paste') {
if (await checkWlPasteForImage()) return true;
} else if (linuxClipboardTool === 'xclip') {
} else if (tool === 'xclip') {
if (await checkXclipForImage()) return true;
}
return false;
@@ -264,12 +264,13 @@ export async function saveClipboardImage(
if (process.platform === 'linux') {
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;
return null;
}
if (linuxClipboardTool === 'xclip') {
if (tool === 'xclip') {
if (await saveFileWithXclip(tempFilePath)) return tempFilePath;
return null;
}