Notification when clipboard changes

I have created a MACRO that notifies me when anything in any application is copied to the clipboard:

However, there are these annoyances:

  1. The notification stays there forever. There is no "Idle Watch" Action to automatically hide the notification e.g. after 2 seconds (or when the mouse is moved or a key is pressed), that can be started after the notification.

  2. The notification shows the clipboard text if a text has been copied. But it does not show the image when I copy a graphic to the clipboard.

Is there a remedy for these annoyances?

For annoyance #1 I can add a Pause Action:
image

But there seems to be no Action to hide the notification after that Pause.

After having set MK Notifications from Alerts to Banner, the notifications expire after a few seconds. But the time is still too long - I would prefer 1 - 2 seconds.

Finder has a window that permanently shows the content of the clipboard. But this window disappears when the Finder window loses the focus.

As far as I know there is no way to change the time a system notification appears for. You could instead use a custom HTML prompt, or large notification, since both of those can be customized to disappear after a set time. The large notification of course is likely to interfere with your workflow.

Another option (and the one I would use since I'm unfamiliar with HTML) is to use the display text in a window action, and follow it with this AppleScript:

Click to expand/collapse AppleScript
----------------------------------------------------------
# Author:				Chris Thomerson
#
# Current Version:		1.0
# Version History:		1.0 (Initial script)
#
# Created:				Sunday, December 26, 2021
# Modified:				Sunday, December 26, 2021
# macOS:				11.6.2 (Big Sur)
#
# DISCLAIMER
# Permission to use, copy, modify, and/or distribute this
# software for any purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
# THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
----------------------------------------------------------

--sets the window name to be used later in the AppleScript
set kmWin to "Keyboard Maestro - Display Text"

tell application "System Events"
	tell application process "Keyboard Maestro Engine"
		
		--pauses until the window appears
		repeat until window kmWin exists
			delay 0.1
		end repeat
		
		--sets the window's size and position, change these numbers to adjust where and how large it appears on screen
		tell window kmWin
			set its size to {300, 200}
			set its position to {1440, 0}
		end tell
		
		--delays for 2 seconds, change the number to change the time the window is shown for
		delay 2
		
		--clicks the OK button to dismiss the window
		click button "OK" of window kmWin
		
	end tell
end tell

This AppleScript waits until the text display window appears, sets it's size and position, waits 2 seconds and then dismisses it. It's pretty self-explanatory, but try it out and let me know if you have questions or troubles with it.

-Chris

@Peter_Panino for #1, use this macro:

for #2, I'm pretty sure someone shared a preview clipboard macro in the forum recently, a couple months ago.