Copying the selected variable

I am trying to create a floating menu that will appear after clicking on a link. I wanted one of the options to be the ability to copy that link. However, I don't see a way to copy the variable "{BTT_OPENED_URL}" to the clipboard. Is it possible to save the value of this variable to the clipboard?

You can use a little JS to achieve that:

async function copyToClipboard() {
      let url = await get_string_variable("BTT_OPENED_URL");
	  let result = await set_clipboard_content({content:url, format: 'NSPasteboardTypeString'})
	  return result;
}

However, can you describe your usecase a bit more? I think there is probably a better way.

Here is what I have created:

I made a small window using a floating menu that appears whenever I click any link in the system. Then, I can choose which browser I want to open the link with, or I can simply copy it.

1 Like