Jump to content

Cmd-C ignored in iTerm and beeps if Alfred is running


Recommended Posts

When I am in iTerm, I select text with the cursor and type cmd-C to copy it. When I do this, there's a 10-20% chance it will make a sound (the "Pluck" sound from macOS's built-in sounds). When this happens, the text is not copied to the clipboard.

 

If I select text in iTerm and repeatedly type cmd-C, if I do that slowly (1 time per second), I get no sound. If I type cmd-C faster (2 or 3 times a second), then it beeps about once a second.

 

This has been driving me nuts for months. I'm deep in my coding and suddenly get this sound. It makes me jump a bit. I can't turn down the volume on it. In System Settings, you can adjust the sound of the notification sound, but this sound is always at my standard volume level. I've set the options in iTerm for silent bell, so it's not that.

 

I even did a full rebuild of my machine (fresh macOS install, re-downloaded all my apps, blew away ~/Library) just to try to get rid of this problem. It came back though. Today, I had the idea to close all running apps to see if that helped, and that's how I discovered that quitting Alfred solved the problem.

 

Alfred version: 5.1.4 [2195]

macOS version: 14.2

Link to comment

@Steve Ball iTerm will copy the selection to the clipboard automatically (without using ⌘C). If you're subsequently using ⌘C, you're going to be triggering Alfred's clipboard merge function. You have 2 options:

 

1. Disable automatic copy to clipboard on selection in iTerm

2. Disable clipboard merging in Alfred

 

Let me know how you get on :)

 

Cheers,

Andrew

 

[moving to Discussion and Help]

Link to comment

Thank you., @Andrew🙏

 

Both those options work for me 🙂. Given that I didn't know merge pasting existed, turning it off is the easy fix.

 

There was also another option:

 

3.  Uncheck 'Play a sound when appending' (this also solves my issue)

 

Note that the help text for this field is 'Plays the system 'Purr' sound when an item is successfully appended', but in macOS Sonoma that particular sound has been renamed to Pluck.

 

My problem is solved but just in case this affects others, it appears that there's a bug in the double cmd-C detection. I have tested it and found that when I select text with the mouse, then pause, then type cmd-C (once), there is no sound. But if I select text and quickly type cmd-C then I get the Pluck sound. It is as if when cmd-C is pressed, the logic is looking at the timestamp of the most recent thing copied to the clipboard, seeing that it's very recent, and incorrectly concluding that it must be because it's a double cmd-C situation. Does the clipboard in macOS say which application put the content there? If so, the test could be amended to be... if something was recently copied to the clipboard (<1s) AND that application was Alfred, then perform a merge.

 

Many thanks again for the quick response and solution!
 

Link to comment

@Steve Ball The clipboard merge already takes into account both the timing, and focused app.

 

In the case of iTerm, if you select some text (iTerm automatically copies), then you immediately ⌘C, then this is two fast (<0.5s) sequential copies to the clipboard, both with iTerm focused, which Alfred interprets as a "clipboard merge".

 

Note that Alfred isn't using macOS events for this, simply looking at the macOS clipboard counter and the focused app. Alfred doesn't differentiate *how* the item was copied to the clipboard.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...