Toggle Alfred Clipboard Merging Feature

Howdy folks,

Some of you use Alfred for many things, and one of my favorite features is the clipboard manager. I use Keyboard Maestro’s clipboard manager as well, but Alfred has a neat feature called clipboard merging, where double-tapping ⌘C will append the current clipboard with the currently selected item(s).

However, sometimes I want to quickly disable/enable this feature. This normally involves opening the Alfred preferences, navigating to Features > Clipboard History > Merging and toggling it there. But this macro reads and writes directly to the clipboard preferences plist file using the built-in macOS PlistBuddy program, allowing this macro to toggle clipboard merging 100% in the background, and instantaneously.

NOTE: The folks over at Alfred have told me that this is not a “published” method of toggling the clipboard merging feature, and therefore may not work with future releases, though they appended that with “it’s likely to always stay the same”.

Enjoy, and feel free to reach out if you need help or have suggestions!

-Chris

RELEASE NOTES, INSTRUCTIONS AND DISCLAIMER

Purpose of this macro (click to expand/collapse)

Quickly toggle Alfred’s clipboard merging feature.

How this macro works (click to expand/collapse)

This macro makes use of macOS PlistBuddy to modify Alfred’s clipboard preferences plist file to enable or disable the clipboard merging feature.

How to configure this macro (click to expand/collapse)

Put the path to your clipboard preferences plist file in the shell scripts.

By default this is:
~/Library/Application Support/Alfred/Alfred.alfredpreferences/preferences/features/clipboard/prefs.plist

Make sure to escape any spaces in the file path. For instance, the above path would become:
~/Library/Application\ Support/Alfred/Alfred.alfredpreferences/preferences/features/clipboard/prefs.plist

NOTE: In the example macro, the path points to a directory in Dropbox since I use that to sync my Alfred preferences between multiple devices.

How to use this macro (click to expand/collapse)

Triple tap the ⌘ button on your keyboard.
By default this is configured for Extended Magic Keyboard and MacBook keyboard.

Disclaimer (click to expand/collapse)

TL;DR: I built it and it works for me. You can share/modify it how you want. But don't blame me if it doesn’t work for you :laughing:

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.

==CURRENT VERSION: 1.0.0 (Friday, April 14, 2023)==

v1.0.0 Friday, April 14, 2023
Initial macro

Toggle Alfred clipboard merging.kmmacros (23 KB)

Macro screenshot (click to expand/collapse)

3 Likes

Hi, @cdthomer, thanks for sharing. I use and love Alfred and will definitely give this macro a try.

Coincidentally I've been hacking around with a macro that saves/restores sets of Bartender 4 preferences so that I can quickly set up my macOS menu bar in a minimal state for screencast recording. When I get it done, maybe I'll share, but I doubt if many folks would want to mess with this BT4 Preference change.

1 Like

Hello Chris (@cdthomer) - very spiffy one - no more opening Alfred’s Preferences and navigating via found images !! That’s great - thank you.

Greetings from Germany

Tobias

2 Likes

Hello Jim (@_jims) I am using Bartender V4, too..

Would love to see this Macro from you - maybe you are using Bartender V3 on your older systems, too and have an idea how to quickly change the Menubar with this version, too?

Greetings from Germany

Tobias

1 Like

Hi, @Nr.5-need_input. When I finish and test this macro sufficiently I'll let you know. I've got it mostly working with BT V4, but for some reason, there is an inconsistency with the menu item spacing.

I have no idea if the same approach would work with earlier versions, but maybe I'll take a quick look into that later. My main objective, however, is V4 because that's the system that I use to record screencasts.