Preview Clipboard

I often want to have a brief look at the contents of the system clipboard and was becoming less and less enamoured with pasting the contents into a throwaway document.

This macro displays a "popup" preview of the clipboard's contents. It's activated by pressing and holding down the hotkey (currently set as ⟨Ctrl⟩+⟨Backtick⟩, i.e. ⌃`). Releasing the hotkey closes the preview (most of the time).

AppleScript

Both AppleScripts contain the same content, but differ in which handler they execute:

use application "System Events"

property KME : "Keyboard Maestro Engine"
property process : a reference to the process named KME

script clipboardPreviewWindow
	property window : a reference to (windows of my process ¬
		whose name = "Clipboard Entry")
	property AXCloseButton : a reference to attribute "AXCloseButton" of my window
	property button : a reference to value of AXCloseButton
	
	
	on exists
		my window exists
	end exists
	
	to close
		perform actions of my button
	end close
end script


close the clipboardPreviewWindow

Preview Clipboard.kmmacros (39.1 KB)

5 Likes

I usually use Alfred clipboard history search for this. On activation it shows the item in the clipboard now and is super fast to show and activate. This way you can also instantly make a search on your clipboard if need be.

1 Like

I also use Alfred's clipboard manager as my main (only) clipboard manager. As you say, it is fast and searchable. However, to get to the first history item, I need to activate the clipboard manager then press the ⟨↓⟩ arrow key. Then I have to close the Alfred search bar either by pressing ⟨escape⟩, or by clicking elsewhere on the screen. The number of actions, plus the distance my hand and fingers must travel to achieve all of this is sufficiently cumbersome to make my Preview Clipboard macro a substantial benefit.

Add to this that Alfred's clipboard viewer doesn't display rich formatted text, so it's not showing you what is really on the clipboard in this context. However, the macro doesn't resolve file objects well enough in the way Alfred's clipboard manager does, so that is something I may address later.

Searching is not relevant to the use cases of this macro, as it's about reviewing what was last copied when one cannot recall the specifics of the content.

My need which fuelled this macro's creation is largely centred on reviewing text content swiftly and without causing disruption to what I am typing/editing.

1 Like

That's not true for me. Instantly on activate I see the first item in my clipboard history (current clipboard).

Awesome macro though. :slightly_smiling_face:

The way the macro is triggered/toggled. Genius!

2 Likes