Clipboard History Switcher

Hello, I have a Macro that activates the Clipboard History Switcher. I want to improve its functionality:

  1. When invoking the Clipboard History Switcher, the cursor should automatically be placed inside the Search Box.

  2. The maximum time the list of clipboard items is kept (or the maximum number of clipboard items) is limited (just one or two days?). How can I increase it?

Is it possible to achieve this?

When the Clipboard History Switcher is active, pressing F will highlight the search field.

If you want to make this automatic, one way is the add an Action that presses F to the Macro you already have that invokes the Clipboard History Switcher.

But the problem with that is that when you use the same hotkey to run the Macro again (to close the Clipboard History Switcher) the search field will get highlighted in the Keyboard Maestro Editor. So, the Macro needs to test whether the Clipboard History Switcher is open or not. Here's one way that can be done:

Activate Clipboard History Switcher - with Search.kmmacros (31.4 KB)

Click to Show Image of Macro

Have a look here, scroll down the page until you get to bit about Clipboards and it explains how to increase the number from the default 200.

Hello Zabobon,
Thank you for the Macro. Unfortunately, it does not work always (sometimes it's not executed) and it adds a lag to the Macro execution.
I always close it with the ESC key - I don't type the hotkey twice.

Do you know how to increase the capacity of clipboard items?

That's odd, it works fine on my system and has no lag. Unless anyone else can come up with a way to make it work more reliably for you, probably simplest is to just press F to enter the search field :grinning:

I added that to my first post. Have a look here, scroll down the page until you get to bit about Clipboards and it explains how to increase the number from the default 200.

Hello Zobobon,

I do not understand how to increase the clipboard capacity. This is my Preferences dialog:

image

What do I have to enter here?

I assume this is a kind of scripting language. But the UI is not helpful. Indeed, there is no UI at all.

The instructions in the Keyboard Maestro on how to increase the number of items that can be stored in the Clipboard History make use of the Mac Terminal and typing in a Command Line.

Preferences Set by Command Line

You can configure various preferences using defaults write from the Mac OS X Terminal. Some preferences will take effect immediately, but others may require the editor or engine to be relaunched. These preferences are documented here only to provide utility. Their behaviour may change in the future, or have unexpected consequences.

You would need to open Terminal.app (from Applictions/Utilites on your Mac) and type or paste in a Command Line followed by return. If you are not already familiar and comfortable with using the macOS Terminal I would strongly recommend caution as you could mess things up on your Mac.

I'm coming from Windows.

I am still wondering about some weird Mac rules. For example: Having to use Terminal commands to change preferences in a specific Mac user application (not system preferences) IS WEIRD because you risk messing up your whole system by changing only the settings of a local application.

IMO mixing local data and system data for me is a NOGO. Even after Windows started using the Registry for the storage of settings I still use local INI and XML files for Preferences storage in my apps, because Windows makes the same error: Mixing local and system storage.

Although Windows has a Registry Editor where you can visually SEE what you are editing. Does Mac have a tool like the Windows Registry Editor?

It is not the norm to set Application Preferences using the Terminal. But in this case this is a hidden setting and currently it’s the only way to set it.

I suspect it might be hidden because increasing the limit from 200 could have performance issues and so, is not officially supported but can be done at the user’s own risk.

So I have to thank you for providing this documentation and the terminal commands. But I wonder why the maker of Keyboard Maestro does not provide a UI in the Preferences for making those changes.

This is rare, and usually for features that are best not messed with without full consideration -- think of it as a "power user" feature rather than a limitation.

They aren't mixed. com.stairways.keyboardmaestro.editor is a discrete file and any changes in there have absolutely no bearing on the OS -- or even on how KM behaves in other user accounts.

1 Like

Personally I think this is a no-brainer...

The Clipboard History Length setting is one that users regularly want to be in control of, and it should be resident, obvious, and evident in the Keyboard Maestro Editor's preferences.

Unfortunately @peternlewis does not agree with this – dislikes adding additional preferences/complexity – and elects to make it an “expert” setting.

Virtually all clipboard-history apps these days have such a user-setting – and no normal user would ever think to look into Terminal-driven settings for apps on the Mac.

Please feel free to send Peter feedback at the support address: Contact Keyboard Maestro Support. He is not guaranteed to read any individual post on the forum.

I think you are confuses as to what the defaults tool does.

In the absence of explicitly setting the -globalDomain flag (as is almost always the case), it affects only the files (preferences) of the local user. Most uses of the defaults command you'll find on the net affect only the local user.

Again, I don't think you entirely understand the preference system on the Mac. The defaults command specified in the document affect the Keyboard Maestro preference files in the user account - exactly the same preference files in exactly the same way as if you make a change in the Keyboard Maestro preferences (or make some other change in Keyboard Maestro that is stored as a preference, such as moving a window whose location is stored in the preferences).

There is no system settings altered by the use of the defaults command in the way it is specified, and no mixing of local and system data.

The argument can and has been made. Maybe one day I'll change it. In the mean time, people are free to ignore the hidden preferences and just assume there is no configuration for the settings available.

I document the hidden settings solely to allow folks to change things that most people will never want to change, and which otherwise would be immutable. Adding preferences adds complexity for the user, complexity for me, and maintenance issues. The hidden preferences are hidden in part because I make not assurance that they will continue to operate in the future, and in part because I prefer the interface to be simpler, and in part because I don't want to implement UI for settings that are either complex or rarely needed.

Maybe one day I'll decide that these preferences are sufficiently interesting to a sufficient number of people to warrant a place in the Keyboard Maestro preferences. But I can tell you I can count on my fingers and toes the number of times people have requested this ability in the last decade.

You can also edit the preferences with my app "Prefs Editor" - no need for Terminal.

Do you mean you made an app only for editing the preferences of KM?

I didn't understand this phrase, although I tried. Perhaps I don't understand the Mac language (as I come from Windows and I primarily work in Windows [I'm not a window cleaner]).

No, he means this. As a RegEdit user you may be more comfortable here than using defaults in the Terminal.

(A suggestion, not an endorsement -- I've never used Thomas's app.)

But, before you start, cast your eye over this primer on macOS Preferences.

1 Like

Do you mean the "defaults editor" is something like the Registry Editor in Windows? I.e., a VISUAL UI for editing non-visual/abstract data?

From what I read on this primer, the Mac OS takes control over all user preferences. Does the Mac OS have the same total control over the user's DATA?

What does that even mean?

That was a rhetorical question. We all know what both Microsoft and Apple do with our data...