LangSync

One keyboard layout on both Macs.

LangSync is a free menu-bar app for Apple Screen Sharing. Switch the layout with ⌘Space and the Mac you control switches with you. Dictated text and copied images land on the remote Mac too.

Version 1.6.0 for macOS 13 or later, Apple silicon and Intel. Signed with a Developer ID and notarized by Apple, MIT-licensed.

server-mac
Notes.txt
Hello, server
The top menu bar belongs to the Mac you sit at. Inside the Screen Sharing window is the Mac you control. With LangSync, ⌘Space switches both, and the next letter you type comes out in the new layout.

Typing through Screen Sharing breaks in three ways

  • The layouts drift apart

    ⌘Space goes to the remote Mac, but the letters you type follow your own Mac’s layout. One side switches, the other doesn’t, and you get gibberish.

  • The next key goes missing

    The keystroke right after ⌘Space can get lost while the remote Mac is still switching. You notice only when the word comes out short.

  • Dictation pastes the wrong thing

    Superwhisper and similar apps put text on the clipboard and press ⌘V. Screen Sharing syncs the clipboard only when its window becomes active and sends modifier keys separately, so you get the old clipboard or a bare “v”. Copying images is hit and miss, too.

What LangSync does

It runs on each Mac and talks to its twin over your network. It only steps in while you work in a Screen Sharing window; the rest of the time your Macs are left alone.

  • The same layout on both Macs

    Switch on either Mac and the other follows, in both directions. LangSync sends the exact layout, not “next one”, so the two can’t fall out of step.

  • ⌘Space that never drops a key

    Inside Screen Sharing, LangSync catches ⌘Space and your “select next input source” shortcut and switches straight away, so the next letter lands in the new layout.

  • Dictation pastes on the remote Mac

    When Superwhisper or a similar tool writes the clipboard and fires ⌘V, LangSync swallows only that synthetic ⌘V and sends the text across. The remote Mac pastes it with a real ⌘V and puts its own clipboard back a second later.

    The ⌘V you type yourself is never touched, and keys you press during the paste wait for it to finish.

  • Images reach the other side

    Copy an image on your Mac, click into the Screen Sharing window, and it is already on the remote clipboard.

  • Several Macs, and chains of them

    One Mac can control several and be controlled at the same time, say an office Mac you reach from home that itself controls a server. LangSync reads the title of the focused Screen Sharing window to pick the right target, and relays layout and dictation along chains like A to B to C.

    Windows to Macs without LangSync, or sitting at a login screen, are left alone.

  • Encrypted between your Macs

    Every message is encrypted and authenticated with a 256-bit key that never crosses the network, and the controlled Mac answers only local networks and VPNs. More on security.

LangSync shows the current layout code (EN, UA, RU and so on) in the menu bar. Click it for everything else. There is no settings window.

How it works

Screen Sharing carries the picture, keys and mouse as usual. LangSync adds a small side channel of its own between the two Macs for the things Screen Sharing gets wrong.

LangSync next to Screen Sharing The Mac you sit at, on the left, connects to the Mac you control, on the right, through Screen Sharing, which carries the screen, keyboard and mouse. Beneath it, LangSync runs an encrypted side channel: UDP port 47811 keeps the layout in sync both ways, and TCP port 47812 carries dictated text and images. UA UA Mac you sit at Catches ⌘Space and dictation’s ⌘V UA Mac you control Follows the layout, pastes dictated text Screen Sharing screen one way, keyboard and mouse the other LangSync side channel UDP 47811layout, both ways TCP 47812dictated text and images ChaCha20-Poly1305, shared key LangSync next to Screen Sharing The Mac you sit at, at the top, connects to the Mac you control, at the bottom, through Screen Sharing, which carries the screen, keyboard and mouse. Beside it, LangSync runs an encrypted side channel: UDP port 47811 keeps the layout in sync both ways, and TCP port 47812 carries dictated text and images. UA Mac you sit at Screen Sharing screen, keyboard and mouse LangSync UDP 47811 layout TCP 47812 text, images UA Mac you control

Layout, both ways

When the layout changes on one Mac, LangSync tells the other which layout to use over UDP port 47811. Your Mac only sends and follows while its Screen Sharing window is in front.

The right Mac, every time

Each Mac reports its names and addresses. LangSync matches them against the title of the focused Screen Sharing window, so with three windows open, the one you are typing in gets the layout.

Text and images

Dictated text and copied images go over TCP port 47812. The remote Mac pastes with a real ⌘V and restores its clipboard after one second.

Set it up in four steps

Install LangSync on every Mac involved: the one you sit at and each one you control.

  1. Install

    Download the DMG, drag LangSync to Applications and open it. macOS asks once because it came from the internet. The layout code appears in the menu bar.

  2. On the Mac you control

    Turn on Цим Маком керують (This Mac is controlled). The menu then lists this Mac’s addresses, for example 192.0.2.10 on the local network or 100.64.0.10 on Tailscale.

  3. On the Mac you sit at

    Choose Додати Мак… (Add Mac…) and enter that address. Repeat for every Mac you control.

  4. Share the key, grant access

    Each Mac makes its own key on first launch, so pick one: choose Скопіювати ключ (Copy key) there and Вставити ключ із буфера (Paste key from clipboard) on the others. A key looks like v2: followed by 64 hex characters; keys from versions before 1.6 don’t work. The 12-character fingerprint next to Ключ (Key) in the menu must match on every Mac.

    Then allow the permissions below. Menu items marked ⚠︎ open the right settings pane.

Permissions

Layout sync works without any of these. They power ⌘Space interception and dictation paste.
PermissionMac you sit atMac you control
AccessibilityNeeded to catch ⌘Space and dictation’s ⌘V, and to tell several Screen Sharing windows apartNeeded to paste dictated text
Input MonitoringNeeded to catch ⌘Space and dictation’s ⌘VNot needed
Local NetworkAllow if macOS asksAllow if macOS asks

Security

There is no account, no server and no analytics. Your Macs talk only to each other, and since version 1.6 every message between them is encrypted and authenticated.

Keep the key private. Anyone who has it and can reach the controlled Mac can make it paste text and press ⌘V, even when no Screen Sharing session is open.

Use LangSync on a network you trust or over a VPN such as Tailscale, and never expose its ports to the internet. To rotate the key, delete ~/.config/langsync/token on one Mac, reopen LangSync and copy the new key to all the others.

A 256-bit key that stays on your Macs
The key, v2: followed by 64 hex characters, is created on first launch and copied between Macs by you. It never travels over the network. The menu shows only a 12-character fingerprint of it. Copy key marks the copied key so clipboard managers skip it, and clears it from the clipboard after 60 seconds; Paste key refuses a key that arrived through LangSync itself. Keys from versions before 1.6, which did cross the network in clear text, are refused and replaced.
Encrypted and authenticated
Layout, text and image messages are sealed with ChaCha20-Poly1305, under separate HKDF-SHA256 keys for each direction and kind of message. A message made with another key, or changed on the way, is dropped. Padding hides exact lengths.
Replays are rejected
Layout messages carry a timestamp and a one-time nonce: anything more than two minutes off, or seen before, is refused, so keep the Macs’ clocks roughly in sync (setting the time automatically is enough). Every clipboard connection starts with a fresh random challenge from the controlled Mac, and the request and reply are bound to it, and to the controlled Mac’s identity (remembered on first contact, like an SSH host key), and each reply to the request’s own nonce. So a recorded request is useless on another connection, can’t be redirected to another Mac or replayed after a restart, and an old reply can’t pose as a new one, whatever the clocks say.
Local networks only
The controlled Mac accepts connections only from local and VPN address ranges, Tailscale’s 100.64.0.0/10 included. It allows at most 4 connections per address and 16 in all, and drops any that don’t authenticate within 2 seconds. A controlling Mac accepts layout messages only from the Macs it controls, and a controlled Mac only those addressed to it.
What it doesn’t protect against
Anyone with the key on your network can make the controlled Mac paste, with or without a Screen Sharing session. There is no forward secrecy. Within the two-minute window, a captured layout packet could be replayed to another of your Macs, which can only switch its layout. The log contains the names and addresses of your Macs, never the key or clipboard contents.
Open to inspection
The whole protocol is in Sources/Core.swift. Found a vulnerability? Please report it privately through GitHub security advisories rather than a public issue.

Questions

Does LangSync change my layout outside Screen Sharing?

No. The Mac you sit at sends and follows only while a Screen Sharing window is in front. Switch to any other app and your layout is yours again.

Do I need it on both Macs?

Yes, on the Mac you sit at and on every Mac you control. Screen Sharing windows to Macs without LangSync, or to a Mac at its login screen, are left alone.

Which layouts does it support?

Any keyboard layout or input source macOS offers: English, Ukrainian, Russian, German and the rest. LangSync sends the exact layout; if the other Mac doesn’t have it, it picks one for the same language. Adding the same layouts on both Macs gives the best match.

Does it work over the internet?

Only through a VPN such as Tailscale. The Macs need to reach each other on UDP 47811 and TCP 47812, and the controlled Mac answers only local network and VPN addresses, so it won’t respond from the public internet even if the ports are open. Don’t open them anyway.

Which dictation apps work?

Superwhisper, and any tool that puts text on the clipboard and presses ⌘V for you. You can turn this off in the menu. A ⌘V you press on the keyboard is never intercepted.

Why does it need Accessibility and Input Monitoring?

To catch ⌘Space and the dictation app’s ⌘V before Screen Sharing forwards them, and to press ⌘V on the controlled Mac. Layout sync itself works without either permission.

How do I get the key from one Mac to another?

Choose Copy key on one Mac, then Paste key from clipboard on the other. The Screen Sharing clipboard or Universal Clipboard can carry it across, and the copied key is cleared from the clipboard after 60 seconds. Every Mac must use the same key: check that the 12-character fingerprint next to Ключ (Key) in the menu matches on all of them. A key looks like v2: followed by 64 hex characters.

I upgraded from 1.5 and the Macs stopped talking. What now?

That’s expected. Version 1.6 uses a new encrypted protocol that older versions don’t understand, and it refuses their keys, which travelled over the network in clear text. Update LangSync on every Mac. Each one replaces its old key and shows a warning in the menu asking you to copy the new key to your other Macs. Pick one Mac, choose Copy key there and Paste key from clipboard on the rest, then check that the fingerprints match.

Does the controlled Mac accept pastes when I’m not connected?

Yes. While This Mac is controlled is on, it pastes for anyone on your network who has the key, Screen Sharing session or not. Keep the key private and turn the option off on Macs you don’t need to control.

The menu is in Ukrainian. Is there an English version?

Not yet. The strings are in Sources/app/main.swift, and a translation or localization pull request is very welcome. The translation table above covers every item in the meantime.

Something isn’t working. Where do I look?

Open the log from the menu, or find it at ~/Library/Logs/LangSyncApp.log. To write the current menu state into the log, run:

pkill -USR1 -f LangSync.app/Contents/MacOS/LangSync

Attach the relevant lines when you open an issue, after removing any addresses or names you would rather keep private.

What do I need to run it?

macOS 13 Ventura or later on Apple silicon or Intel. The app is universal, signed with a Developer ID and notarized by Apple.

Is it free?

Yes. LangSync is open source under the MIT license.

Build it yourself

LangSync is plain Swift with no Xcode project. build.sh compiles it with swiftc into a universal app. You only need the Xcode Command Line Tools.

A plain ./build.sh makes a signed, notarized release and needs a Developer ID Application certificate plus a notarytool keychain profile named langsync-notary. LANGSYNC_TEAM_ID picks the team.

# a build for this Mac only, no certificate needed
git clone https://github.com/developerscompany/langsync.git
cd langsync
LANGSYNC_LOCAL=1 ./build.sh

# install the newest DMG on another Mac, keeping its settings
./deploy.sh office-mac      # an SSH host, or "local"
Sources/Core.swiftLayouts, layout sync, hotkey tap, clipboard, wire protocol
Sources/app/main.swiftThe menu-bar app
Sources/cli/main.swiftLegacy command-line agent
build.shBuild, sign, notarize, make the DMG
deploy.shInstall the latest DMG on a Mac over SSH
make-icon.swiftDraws the app icon