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;
}