Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility of a setting to paste after selection? #7

Closed
lowercasename opened this issue May 20, 2019 · 4 comments
Closed

Possibility of a setting to paste after selection? #7

lowercasename opened this issue May 20, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@lowercasename
Copy link

I was wondering if you would consider adding an optional setting in Maccy to simulate a Cmd+V keypress after a string is chosen in Maccy - thus pasting whatever has just been moved into the clipboard at the current position of the cursor? I'm not sure how feasible this is on macOS without demanding accessibility permissions from everything.

@p0deje p0deje added the enhancement New feature or request label May 22, 2019
@p0deje
Copy link
Owner

p0deje commented May 22, 2019

I'll investigate if this possible, but I have to warn that I'm not sure when exactly I'll be able to do that.

@lowercasename
Copy link
Author

Hi! So after using Maccy for the last month, I kind of love the current functionality. It allows me to have chosen the clipboard text in advance of placing my cursor, which is something I didn't consider would work so conveniently as a workflow for me. So while I'm sure some people would benefit from this feature, I've actually very quickly got used to the way it works now! :)

@p0deje
Copy link
Owner

p0deje commented Jul 2, 2019

I've been trying to figure out the way to properly implement the following functionality:

  1. When you hit Enter - it behaves the same as now (copy + no paste).
  2. When you hit Shift + Enter - it copies and immediately pastes.

However, I haven't found a reliable way to implement this. I've tried to simulate the Cmd+V event but it doesn't always work:

  func paste() {
    let eventDown = CGEvent(keyboardEventSource: nil, virtualKey: UInt16(kVK_ANSI_V), keyDown: true)!
    eventDown.flags = .maskCommand
    eventDown.post(tap: .cghidEventTap)

    let eventUp = CGEvent(keyboardEventSource: nil, virtualKey: UInt16(kVK_ANSI_V), keyDown: false)!
    eventUp.flags = .maskCommand
    eventUp.post(tap: .cgSessionEventTap)
  }

I'm not sure what it might be related to, but since I cannot make it properly work and you mentioned you are fine with the current flow. Let's close this issue for now.

I'll be happy if somebody sends a PR with the Shift+Enter approach that works reliably.

@Henrietta1989
Copy link

Any news on this? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants