Display preview of item in Clipboard History as Trigger tooltip?

Is there any way to:

  1. Display (show on screen) the content of an item in the Clipboard History (by index number)?
  2. Display that either as a tooltip or as pop-up-on-hover Floating Menu Trigger?

The use-case seems straightforward: I have triggers that paste Clipboard-1, Clipboard-2, Clipboard-3, Clipboard-4, and while I remember 1 and 2 I am rarely sure what’s actually on 3 or 4, and I’d like to confirm it before pasting without having to display the Clipboard History window.

The Triggers, btw, let me quickly paste the last 3 or 4 items in the order they were clipped. Clicking the Trigger “Clip3” three times gives me “Clipboard 1”, “Clipboard 2”, “Clipboard 3”.

Thx. —Kirby.

The example menu here contains a clipboard submenu: Hierarchical floating menu template - #5 by Andreas_Hegenberg

It works using this floating menu content script using the get_items_from_clipboard_manager function:

async function retrieveJSON() {
  let clips = JSON.parse(await get_items_from_clipboard_manager({start: 0, numberOfItems: 10}));;
  
  let itemsToReturn = [];
  for(let clip of clips.items) {
       itemsToReturn.push({
	    "templateItemUUID": "C1F3BCFB-9107-4DE2-9E72-F2E082D6DA29",
        "title": `${clip.meta?.previewText?.slice(0, 50)}`,
		"action": `js::(async () => { paste_clipboard_manager_items_with_uuids({ uuids: "${clip.meta.uuid}"})})()`
    });
  }
  
  return JSON.stringify(itemsToReturn);
}

Here is just the clipboard example menu:
clipboard_menu.bttpreset (6.1 KB)

You could also use the get_items_from_clipboard_manager function to show a HUD.

For example this would save the preview content of clipboard item number 3 to the variable clip3 which can then be used in a HUD by putting it in curly braces:

async function retrieveThirdItem() {
  let clips = JSON.parse(await get_items_from_clipboard_manager({start: 3, numberOfItems: 1}));;
  let item = clips.items[0];
  let previewText = item.meta?.previewText ?? "N/A";
  await set_string_variable({variableName: "clip3", to: previewText});
  return previewText;
}

Seems like the latest version has stopped the title from working, it is not showing the text added to the title field. Can you please check.
@Andreas_Hegenberg

Have you tried to restart BTT? There hasn't been a change to this since this was posted. What is your exact setup?

async function generateMenuJSON() {
    try {
        const delimiter = "_BTT_SEQ_PASTE_DELIMITER_";
        const stackVariable = "sequentialPasteStack";
        const orderVariable = "pasteOrderMode";
        const enterModeVariable = "pasteAndEnterMode";
		const ignoreModeVariable = "ignoreCopyMode"; // New variable
		const newLineModeVariable = "newLineDetection";
		const templateItemUUIDString = "62373239-24D8-429D-8292-1EA154CEC86E"; 
		
		const fifoIconSymbol = "sfsymbol::arrow.up.arrow.down"; 
		const lifoIconSymbol = "sfsymbol::square.stack.3d.up.fill"; 
		const enterModeActiveSymbol = "sfsymbol::document.badge.plus.fill"; 
		const enterModeDeactiveSymbol = "sfsymbol::moonphase.new.moon"; 
		const undoLastPasteIcon = "sfsymbol::arrow.uturn.backward.circle.fill";
		const ignoreOnIcon = "sfsymbol::notequal.square.fill"; // Icon for when ignoring is ON
        const ignoreOffIcon = "sfsymbol::doc.on.doc"; // Icon for when ignoring is OFF (capturing)
		const pasteAllButtonIcon = "sfsymbol::scissors.badge.ellipsis"; 
		const newLineOnIcon = "sfsymbol::lineweight"; // Icon for when ignoring is ON
        const newLineOffIcon = "sfsymbol::plus.square"; // Icon for when ignoring is OFF (capturing)



        // 1. Get the state for both toggles.
        const currentOrder = await get_string_variable({ variableName: orderVariable }) || "FIFO";
        const enterMode = await get_string_variable({ variableName: enterModeVariable }) || "off";
		const ignoreMode = await get_string_variable({ variableName: ignoreModeVariable }) || "off";
		const newLineMode = await get_string_variable({ variableName: newLineModeVariable }) || "off";

        // 2. Create the toggle buttons.
        const orderToggleButton = {
			"templateItemUUID": templateItemUUIDString,
            "title": { "text": ``, "size": 2, "color": "#A9A9A9" },
            "backgroundColor": "30,30,30,255",
			"BTTMenuElementTooltip" : "MyToolTip",
            "action": {
				"named": "togglePasteOrder"
			},
			"icon": currentOrder === "FIFO" ? fifoIconSymbol : lifoIconSymbol
        };
        const enterToggleButton = {
			"templateItemUUID": templateItemUUIDString,
            "title": { "text": ``, "size": 10, "color": "#A9A9A9" },
            "backgroundColor": "30,30,30,255",
            "action": {
				"named": "toggleEnterPaste"
			},
			"icon": enterMode === "off" ? enterModeDeactiveSymbol : enterModeActiveSymbol
        };
		const undoPasteButton = {
			"templateItemUUID": templateItemUUIDString,
            "title": { "text": ``, "size": 2, "color": "#A9A9A9" },
            "backgroundColor": "30,30,30,255",
            "action": {
				"named": "undoLastPaste"
			},
			"icon": undoLastPasteIcon
        };
		const ignoreCopyButton = {
			"templateItemUUID": templateItemUUIDString,
            "title": { "text": ``, "size": 10, "color": "#A9A9A9" },
            "action": { "named": "toggleIgnoreCopy" }, "icon": ignoreMode === "on" ? ignoreOnIcon : ignoreOffIcon
        };
		const pasteAllButton = {
			"templateItemUUID": templateItemUUIDString,
            "title": { "text": ``, "size": 10, "color": "#A9A9A9" },
            "action": { "named": "pasteAll" }, "icon": pasteAllButtonIcon
        };
		const newLineDetection = {
			"templateItemUUID": templateItemUUIDString,
            "title": { "text": ``, "size": 10, "color": "#A9A9A9" },
            "action": { "named": "toggleNewLineDetection" }, "icon": newLineMode === "on" ? newLineOnIcon : newLineOffIcon
        };
		
        // This array holds our control buttons.
        const controlButtons = [orderToggleButton, enterToggleButton, undoPasteButton, ignoreCopyButton, newLineDetection, pasteAllButton];

        const stackContent = await get_string_variable({ variableName: stackVariable });

        if (!stackContent || stackContent.trim() === "") {
            await set_persistent_string_variable({ variableName: "pasteQueueStatus", to: "empty" });
            return JSON.stringify(controlButtons); // Show controls even if empty.
        }
        
        const itemsArray = stackContent.split(delimiter).filter(line => line.trim() !== '');

        if (itemsArray.length <= 1) {
            await set_persistent_string_variable({ variableName: "pasteQueueStatus", to: "empty" });
        } else {
            await set_persistent_string_variable({ variableName: "pasteQueueStatus", to: "not_empty" });
        }
        
        if (itemsArray.length === 0) {
            return JSON.stringify(controlButtons);
        }
        
        const orderedArray = currentOrder === "FIFO" ? itemsArray.reverse() : itemsArray;
        const pasteItems = orderedArray.map((line,index) => {
            const displayLine = line.length > 30 ? line.substring(0, 30) + '...' : line;
			if(index === 0){
				return {
					"templateItemUUID": "FBA5D74D-5C46-453D-BF8B-ED836E659AD9",
					"title": displayLine,
					"backgroundColor": "50,50,50,255"
				};
			} else {
				return {
				"templateItemUUID": "F7582E57-F563-466E-8E3A-60B2D1B9A2FF",
                "title": { "text": displayLine, "size": 14, "color": "#FFFFFF" },
                "backgroundColor": "50,50,50,255"
            };
			}
        });
        
        // Combine control buttons with the paste items for the final menu.
        const finalMenu = [...controlButtons, ...pasteItems];
        return JSON.stringify(finalMenu);

    } catch (error) {
        console.error("Error generating menu JSON:", error);
        await set_persistent_string_variable({ variableName: "pasteQueueStatus", to: "empty" });
        return JSON.stringify([]);
    }
}

This is currently not working. When adding the text, it shows the Menu item without the title

@Andreas_Hegenberg Any updates about this?? Title or the text stopped showing