Skip to content

Fixes Windows to macOS keyboard paste. - #1

Open
pocketlim wants to merge 1 commit into
TURX:masterfrom
pocketlim:bugfix/win10_to_macos-nspasteboard-fix
Open

Fixes Windows to macOS keyboard paste. #1
pocketlim wants to merge 1 commit into
TURX:masterfrom
pocketlim:bugfix/win10_to_macos-nspasteboard-fix

Conversation

@pocketlim

Copy link
Copy Markdown

Adds NSPasteboard.general.clearContents() right before NSPasteboard.general.setString() to ensure that the contents are correctly written. A corresponding debug message was added below these lines to show if the NSPasteboard was updated successfully.

According to Apple's own pasteboard documentation, copying is a two-step process: first clear the existing contents to establish your app as the new owner of the pasteboard, then write your data.

How I got to this point

I just wanted to find a random utility that let me copy something from Windows and have it show up on the mac easier than my normal Open Signal, paste something to my notes, go to mac, open Signal, copy from my notes annoyance. I used KDE Connect on the macOS and KDE Connect on Windows, but it never could pair correctly.

Then I found kdeconnect-mac, and tried it out, and it paired right away! However, the "Send Clipboard" never seemed to work. I took a look at the code and figured out that it might need this line to work, and boom.... it works now!

Now I don't have to open Signal every time! Although I guess it's nice having a record of everything that was sent.

Anyway, here's a PR that fixes this issue. Thanks for coming to my TEDTalk.

…rContents() right before NSPasteboard.general.setString() to ensure that the contents are correctly written.

According to Apple's own pasteboard documentation, copying is a two-step process: first clear the existing contents to establish your app as the new owner of the pasteboard, then write your data.
@CL-Jeremy

Copy link
Copy Markdown

Oops, this is the wrong place for a PR. This codebase has long been merged with https://github.com/KDE/kdeconnect-ios (mirror of https://invent.kde.org/network/kdeconnect-ios), as mentioned in the task section of the readme, as well as evident in that repo.

There is also another PR on GitLab (of which this repo is a mirror, so PRs aren't reviewed here, either): https://invent.kde.org/ruixuantu/kdeconnect-mac/-/merge_requests/4/. But even that one should be submitted to the iOS version now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants