This simulates the middle mouse button copy/paste found in Unix/Linux X11 window managers.
If you first highlight arbitrary text or visual elements, you can then middle click in the same or another window to paste the elements. Unlike X11, this program will alter your clipboard. Perhaps a future version could manage its own buffer like X11.
This program assumes that the key combinations Cmd+C/Cmd+V are mapped as copy and paste in your applications. If they are not, then this will not work, because the program simply posts the following events:
- Cmd+C down & up (copies your selected text or objects) whenever your left mouse button releases. This allows copying text that is drag highlighted, or double-clicked to highlight words or lines.
- Left Mouse Button down & up (position mouse cursor for paste insertion) on middle click.
- Cmd+V down & up after tiny delay following middle click.
If your mouse is left-handed, or you remapped the keystrokes, then just edit the C program and recompile.
Run the executable in the background from your shell command-line interface, or run it as a "Login Item" at startup (System Preferences > Users & Groups > Login Items > + > Navigate to file).
-s "App Name" to skip the handling of that application
-c Uses Ctrl instead of Cmd
-n "App Name" Don't focus window before pasting by simulating left click. This was the default behavior, but causes browsers to do weird things trying to open tabs by middle clicking.
make macpaste
./macpaste &
Public Domain 2016