Skip to content
jstilwellPublic

About

Text expansion and a connection manager for the Mac. Built for power users.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

xpnd

Text expansion and a connection manager for the Mac.
Type a keyword in any app and it becomes your snippet: text with the date, the clipboard, or values you're asked for, and keywords that open an app or run a Shortcut. Type another and it opens an SSH, VNC or Windows (RDP) connection.

macOS 14 or later Native Swift MIT license

Download · Changelog

Install

  1. Download the DMG from the latest release and drag xpnd to Applications. It needs macOS 14 or later.
  2. Open it. The welcome window asks for Input Monitoring (to notice a keyword as you type it) and Accessibility (to type the snippet in its place).
  3. The xpnd window opens: add snippets and connections in its sidebar. Closing it leaves xpnd running in the menu bar, where "Open xpnd…" brings it back.

Using it

  • Keywords: type one and it's replaced. Keywords are case-sensitive. A strict snippet (the default) expands when you finish the word: type its keyword, then a space or punctuation, which xpnd types again after the text (;sig becomes Best ). Return and Tab don't expand it, so ;sig then Return sends ;sig. Opening characters such as ( or " may come right before the keyword. A loose snippet expands the moment what you typed ends with its keyword. Return, Tab, arrows, a click, or switching apps start the word over, as does a space. Keys you type while a snippet expands are kept and typed after it; if one of them (an arrow, Return), or a click outside xpnd, may have moved the cursor, the snippet is cancelled and the keyword stays. If you switch apps while a snippet's form is open or its script runs, the expansion is cancelled (the form closed and the script stopped) rather than typed into the wrong app. Keywords can't be seen in password fields or in a terminal with Secure Keyboard Entry on.
  • Picker: press Control-Option-Command-Space (changeable in Settings), or choose Open Picker in the menu bar menu, to search snippets by keyword, name, or text, and press Return to insert one. Each row shows its group.
  • Groups: snippets sit in groups you can turn on or off together.
  • Editing: snippets are edited in the xpnd window. Its sidebar search filters snippets by keyword, name, or text, and connections by name, host, activation string, or folder. To delete a snippet, group, connection or folder, select it and press Delete, right-click it, or use the button in its Details; Edit → Undo (⌘Z) puts it back where it was, and only a folder or group with things in it asks first. Moves and imports undo the same way. Right-click a snippet to duplicate, disable, move or copy its keyword. File → New Snippet (⌘N), New Snippet Group and New Connection add one; Edit → Find (⌘F) searches the sidebar. A snippet's text, keyword and a connection's activation string are saved when you pause typing.
  • Writing snippets: Insert Variable opens a short form for each variable, and right-clicking a variable in the text offers Edit Variable…. Variables are coloured, and one that won't expand (#{key:tabb}, a missing snippet) gets a red underline whose tooltip says why. Under the text, a preview shows what the snippet will type, with a field to try each input; it never runs a script, presses a key or reads your clipboard, so those show as labels such as ‹clipboard› and ⟨Tab⟩. New Snippet from Clipboard in the menu bar menu starts a snippet from the clipboard's text (not from a copied password).
  • First launch: xpnd starts with one snippet, ;date, which types today's date.
  • Import and export: share snippets as YAML. Importing first lists every snippet the file adds, and calls out any that runs a script, opens an app, runs a Shortcut, sends a keyboard shortcut or presses a key; nothing is added until you confirm.

Variables

Written #{name} or #{name:value}. Names are case-sensitive, and unknown ones are left as typed. Use \} and \\ for a literal } and \.

Variable Inserts or does
#{clipboard} The clipboard's text; #{clipboard:trim}, :upper or :lower changes it
#{selection} The text selected in the app, when the snippet comes from the picker (empty from a typed keyword, which has already replaced any selection, and in remote desktops); :trim, :upper, :lower as above
#{date} #{time} #{dateTime} The current date and time
#{date:<shift>} #{time:<shift>} The date or time shifted, such as #{date:+1d} for tomorrow
#{dateTime:<format>} A custom format, such as yyyy-MM-dd
#{dateTime:<shift>:<format>} Shifted by y M w d h m s, signed, such as +1d-2h
#{combo:<keyword>} Another snippet's text (up to 16 levels deep; a snippet can't include itself)
#{upper:<keyword>} #{lower:<keyword>} Another snippet's text, in upper or lower case
#{cursor} Where the caret ends up
#{input:<label>} Asks for a value; #{input:<label>=<default>} starts the field with a default
#{choice:<label>:<a>|<b>|<c>} Asks you to pick one; the first is preselected. An option can't contain |
#{longInput:<label>} Asks for several lines
#{uuid} A new UUID, uppercase
#{fullName} Your full name, from your Mac account
#{envVar:<name>} An environment variable
#{shell:<path>[:<timeoutMs>]} The output of the script at that path (10 seconds by default; 0 for no limit)
#{key:<name>[:<count>]} Presses a key: tab, enter, space, delete, arrows, home, end, f1 to f20, and more (up to 1000 times)
#{shortcut:<keys>} Sends a shortcut, such as Cmd+Shift+J
#{delay:<ms>} Waits, up to 60000 ms
#{openApp:<path>} Opens the app at that path
#{runShortcut:<name>} Runs a macOS Shortcut by name

A label used twice, by any input kind, is one field in the form. If a value can't be worked out (a script fails, a form is cancelled), nothing changes and your keyword stays where it is.

Snippet file

Snippets are kept in ~/Library/Application Support/xpnd/snippets.yaml, the same format export writes. Edit it by hand and xpnd reloads it. Saving from the app rewrites the file and drops comments. If the file can't be read, xpnd leaves it alone and pauses snippets until it's fixed; connection strings keep working.

version: 1
groups:
  - name: Work
    description: Ticket boilerplate
    enabled: true
    snippets:
      - name: Ticket reply
        keyword: ";tix"
        matching: strict        # strict | loose
        enabled: true
        text: |
          Hi #{input:Name},
          Ticket #{input:Ticket #} is resolved as of #{dateTime:yyyy-MM-dd}.
          #{cursor}

Connections

Keep your SSH, VNC and RDP connections in folders and open them by typing, from the launcher, or from the xpnd window (it has a Dock icon; closing it leaves xpnd running in the menu bar).

  • Activation strings: give a connection a string such as ;aws and typing it connects. A folder opens a numbered menu instead: press 1 to 9 to connect, the arrows and Return to pick, Esc to close and keep what you typed. A folder named prod gets ;prod unless you set another or none. It gets none if ;prod is taken, or would cut off a longer snippet keyword or a string you set, such as ;prod2. Snippets and connections share one set of strings: xpnd flags one used twice, and warns when one starts another (;d and ;db), since typing the longer one fires the shorter first.
  • Colors: give a folder or connection a color (red, orange, yellow, green, blue, purple or gray) in its Details. A connection without one takes the nearest folder's, and its name shows in that color in the sidebar, the folder menu and the launcher. In YAML it is color: blue.
  • Icons: give a folder an icon (terminal, PC, desktop, server rack, network, cloud, shield, home or building) in its Details. It replaces the folder symbol in the sidebar, the folder menu and the launcher, and subfolders don't inherit it. In YAML it is icon: terminal.
  • ⌘ for sudo: hold ⌘ while picking a connection in a folder menu (⌘1, ⌘Return or a ⌘-click), in the launcher (⌘Return or ⌘-double-click), or when double-clicking it in the window, and that one connect runs with auto-sudo on, using the connection's sudo credential, its folder's or the global one.
  • Launcher: press Control-Option-Command-C (changeable in Settings) to search connections and press Return to connect. Before you type, it lists your favorites and your last five connections above the folders; while searching, they come first among equal matches.
  • Favorites and notes: star a connection with Favorite in its Details or Add to Favorites in its right-click menu (favorite: true in YAML). Notes (notes:) are free text the launcher searches too.
  • Connect timeout and keepalive: ssh gives up on an unreachable host after 15 seconds and checks a quiet session every 30 (-o ConnectTimeout=15 -o ServerAliveInterval=30, after a connection's own SSH options). They override ~/.ssh/config, so turn off Settings → Terminal → "Add a connect timeout and keepalive" if you set them there.
  • Opens into a terminal: starting xpnd (other than at login) opens its window with a shell tab in your home folder, or the folder set in Settings → Terminal → "Start new terminals in"; File → New Terminal Tab (⌘T) opens another. Turn off "Open a terminal tab when xpnd starts" to open without one. Picking a connection (double-click, Connect, or the launcher) while that shell is selected and sitting at its prompt runs the ssh command in it, after clearing anything half-typed there, so you're back at your prompt when you log out; a string typed in the shell, Duplicate, a busy shell, or Settings → Terminal → "Open connections in the terminal you're using" turned off gives the connection a tab of its own. A shell used this way gets no green dot in the sidebar, and passwords go into it only while ssh runs there.
  • Sidebar: snippets and connections sit beside your tabs, and the button at the left of the tab bar or View → Hide Sidebar (⌃⌘S) hides them (xpnd remembers); while they're hidden, pointing at the window's left edge slides out a tab that brings them back. Settings → General → Sidebar → "Show on mouse-over" keeps them out of the way instead: rest the pointer at the window's left edge and they slide out over the terminal, and slide away when you move off.
  • Built-in terminal: double-clicking a connection in the window (or Connect) opens it as a tab in xpnd's own terminal (or in the shell you're in, as above), built on Ghostty's libghostty (GPU rendering, Ghostty's themes and fonts), on the right; duplicate or close a tab from its menu. Settings → Appearance picks a light and a dark theme from Ghostty's 800-odd, the font, size, line height, ligatures, cursor and padding, with a live preview; Settings → Terminal has Option as Alt, copy on select, hiding the pointer while typing, asking before a multi-line paste, and scrollback; a scrollbar shows while you're scrolled back or point at the right edge. Programs on the server can't read your clipboard (OSC 52 reads are refused), and links they print open only if they're web pages. A tab whose ssh failed shows Reconnect, which connects again in the same place. Typed strings still go to your external terminal as below (a string typed inside a tab opens a new tab), and the choice of default is in Settings → Terminal (pick "xpnd (built-in)" to open tabs instead). Closing the window or quitting asks before it ends open sessions.
  • Uploading files over SSH: drop Finder files or folders on an SSH tab, or choose Upload File… from the tab's menu or the connection's in the sidebar, and xpnd asks which folder on the server (it starts at ~, then the tab's last one) and copies them with scp over the tab's own login, so nothing asks for a password again. xpnd can't see which folder the remote shell is in. Tabs share their login this way (ssh's -M -S with a socket of their own, which also shows in the command typed into a shell tab), and scp never logs in by itself. On a Windows desktop tab, Upload File… copies into the xpnd drive, as a drop on its toolbar does.
  • Files drawer: when an SSH tab's login comes up, a drawer opens beside the terminal (hide it, or reopen it, with the Files button in the tab bar or View → Show Files, ⌥⌘F) showing the server's folders, starting in the folder your shell is in on a Linux server (xpnd asks the server quietly; it never types into your shell), and elsewhere in the tab's last folder or your home folder. Double-click a folder to enter it, a file to open a copy in an editor; each save there writes the server's file in place, so its owner, permissions and labels stay. If the file changed on the server meanwhile, xpnd asks before overwriting. A save that fails says why, with Retry; one cut off partway says the server's file may be incomplete, and Retry writes it again. A file opens in the app for its extension, else the default editor, else the Mac's plain-text editor, never the type's default app. The copies are private to your Mac, kept while the connection has a tab (or a shell tab has run it) and until their saves arrive, and closing a connection's last tab or quitting asks while an edit hasn't. Right-click for Open With, Always Open .ext Files With, Download…, Rename…, Delete… (files and empty folders), New Folder… and Upload Files Here… (which, like a Finder drop, asks before replacing a file that's there). The As root switch (or Save as root after a permission error) runs the server's sftp-server through sudo, with the connection's sudo password sent to sudo's own prompt only. It uses the tab's own login like uploads do, so it's there only while the tab's ssh is running; Reconnect brings it back. Settings → Files turns it off, stops it opening on connect, and sets the editors.
  • Remote desktop (RDP): double-clicking an RDP connection opens the Windows desktop as a tab beside your terminals, using the FreeRDP library bundled in xpnd. The login (user, domain, password) comes from 1Password or the Keychain; the password goes straight to the session and is never copied or typed. While 1Password or the Keychain waits for you (Touch ID), snippets keep working; if the item or its password is missing, the tab opens and Windows asks. It resizes with the tab, asks about unknown or changed certificates and bad passwords, and reconnects after a drop. With Network Level Authentication on (the default) it connects that way or not at all; turn it off for a server that doesn't support it, and the connection uses TLS with the certificate question. Defaults are in Settings → Remote Desktop and can be overridden in a connection's RDP options. Snippets are typed into the tab as keystrokes.
  • Desktop toolbar (the notch): point at the top edge of a Windows desktop, or press ⌘⇧N, for a toolbar with Ctrl+Alt+Del, Win+R, full screen, display size, audio, clipboard sync on or off for the session, the file drop drive, Reconnect, Disconnect and connection details; the pin keeps it open. It acts on the session without changing the saved options, except "Set as this connection's default" in the display panel.
  • Dropping files on a Windows desktop: drop Finder files on the desktop and xpnd pastes them into the window under the pointer, as if you had copied them in Finder (needs clipboard sync on). It clicks and pastes only once Windows has taken the files; otherwise it says it couldn't, and nothing is clicked or typed. Drop them on the toolbar instead to copy them into the xpnd drive, a per-connection folder Windows sees as This PC → xpnd (\\tsclient\xpnd) and nothing else of your Mac. Files Windows saves there appear in it too. Folders aren't copied into the drive. The drive and when its folder is cleared are set in Settings → Remote Desktop and each connection's RDP options.
  • Connected and Disconnect: a green dot on a row means it is connected in a tab; a Windows desktop still connecting or reconnecting has none. While a tab is open, connected or not yet, the row's right-click menu (and Details) has Disconnect, after the usual confirmation, and Show Session to jump to the tab.
  • Terminal: if a terminal (Terminal, iTerm2, Ghostty, Warp, or others you add in Settings → Terminal) is in front, the command is typed into it. Otherwise xpnd opens a new Terminal window, or whatever you pick under "Open in" (iTerm2, Ghostty, or your own command with {command}, which is how to reach Warp). A VNC connection opens its vnc:// address in your default viewer, Screen Sharing unless you changed it.
  • Credentials: a connection uses its own 1Password item, else its folder's (nearest first), else the global one from Settings → Passwords. A sudo item falls back the same way, then to the login password (Settings → Passwords can turn that last step off). An SSH key is used through the 1Password SSH agent. A password is copied to the clipboard, marked concealed, kept to this Mac (no Universal Clipboard), and cleared after 30 seconds unless you've copied something else since. With "Auto-sudo" on, it offers the sudo password after the login one. In the built-in terminal, Settings → Terminal → Passwords can instead send them into the tab: on a click (Send Password, ⌘⇧P) or automatically at the next password prompt within 15 seconds (after that it waits for a click, for up to a minute). Through a jump host, the automatic send waits for the prompt that names the connection's own host, so the jump host's prompt never gets it. Either way xpnd only types at a line that looks like a password prompt, once per prompt; external terminals always use the clipboard.
  • 1Password setup: install the 1Password CLI (op), turn on Integrate with 1Password CLI in 1Password → Settings → Developer, then pick items in Settings → Passwords or a connection's details. SSH keys also need the 1Password SSH agent turned on. The agent offers only keys in your Personal, Private or Employee vault by default; for a key in a shared vault, list that vault in the agent's config file (~/.config/1Password/ssh/agent.toml), or ssh says only "Permission denied (publickey)".
  • macOS Keychain instead: no 1Password? Turn on "Use the macOS Keychain instead of 1Password" in Settings → Passwords, then use Choose… → New Password to save a password in your login keychain. Passwords only; SSH keys stay in ~/.ssh. Credentials you picked from 1Password keep working.
  • Import and export: Settings → Import & Export shares connections as YAML (credential references only, never passwords). Importing shows every connection, its jump host, and its SSH options before anything is added, because they run when you connect. With Replace, it also lists the existing connections it removes and those whose jump host moves to an imported one. An imported connection keeps the login its file gave it, and one whose string a snippet already uses comes in without it. Import from SSH Config… adds the Host entries in ~/.ssh/config (HostName, User, Port, IdentityFile as -i, ProxyJump as a typed jump host) to a folder named "SSH config", skipping patterns like Host *, Include, Match and hosts you already have; the preview says what it left out. A host with other options (ProxyCommand, LocalForward…), one a pattern entry such as Host prod-* also covers, or one whose HostName uses %h connects by its alias, so ssh still reads the file for it.

Connections are kept in ~/Library/Application Support/xpnd/connections.yaml, edited like the snippet file. Its version goes up when a field is added, so an older xpnd sharing the file (through a synced folder) refuses it rather than saving over fields it doesn't know. If it can't be read, xpnd leaves it alone and pauses connection strings until it's fixed; snippets keep working.

version: 2
folders:
  - name: prod                    # opens the menu with ;prod
    color: blue                   # everything in prod without its own color
    connections:
      - id: 6F1B0C52-3A41-4E5B-9D0A-1C2D3E4F5A01
        name: bastion
        host: bastion.example.com
      - name: web-01
        activation: ";web1"       # optional
        host: web-01.internal
        port: 2222                # omit for 22 (SSH), 5900 (VNC) or 3389 (RDP)
        username: deploy
        favorite: true            # listed first in the launcher
        notes: "Ask before rebooting" # optional; searched by the launcher
        type: ssh                 # ssh | vnc | rdp
        advanced:
          jumpHost:
            connection: 6F1B0C52-3A41-4E5B-9D0A-1C2D3E4F5A01   # or text: user@host
          sshOptions: "-o ServerAliveInterval=30"
          autoSudo: true
      - name: win-01
        host: win-01.corp.example.com
        type: rdp
        username: jdoe            # or CORP\jdoe, or [email protected]
        domain: CORP              # optional
        rdp:                      # optional; unset keys use Settings → Remote Desktop
          display: 1920x1080      # or fit
          gateway:
            host: gw.corp.example.com

A jump host chosen from your saved connections must be an SSH connection whose login credential is a 1Password SSH key, or connecting shows an error; a typed jump host (text:) has no such requirement. A chain of saved jump hosts can be at most 5 hops long.

Credentials are 1Password or Keychain references (credential and sudoCredential on a connection, folder, or the file) that Settings fills in for you. Keychain references point at your own Mac's keychain, so they don't carry over to another Mac.

Privacy

  • xpnd keeps up to the last 128 characters you typed, in memory only, to match keywords. They're never stored, logged, or sent anywhere.
  • It puts your clipboard back after each expansion.
  • xpnd's files hold no passwords or keys, only references to 1Password or Keychain items and the public key of an SSH key item (under ~/Library/Application Support/xpnd/keys). With the Keychain instead of 1Password, New Password saves a password in your login keychain, where macOS keeps it.
  • It runs op when you connect, pick or refresh a credential, open Settings → Passwords, or save a new op path there, never in the background. A password is copied concealed and cleared after 30 seconds (unless you've copied something else since), or when you quit.
  • Files from the Files drawer sit on your Mac while the connection has a tab (or a shell tab has run it) and until their edits reach the server; they are stored in ~/Library/Application Support/xpnd/edit and marked as downloaded.
  • Apart from the connections you open, its only network use is the optional update check against updates.xpnd.dev, which you can turn off in Settings.

Building

See docs/DEVELOPMENT.md. Building needs Xcode with its Metal toolchain (xcodebuild -downloadComponent MetalToolchain), CMake (brew install cmake is fine) and an Apple silicon Mac. The first build runs make freerdp, which compiles FreeRDP and OpenSSL into vendor/FreeRDP.xcframework (about 5 minutes), and make ghostty, which downloads a pinned Zig and compiles libghostty into vendor/GhosttyKit.xcframework (about 4 minutes); later builds reuse both, and make build and make test run them when they are missing. xpnd is MIT licensed; the app bundles FreeRDP and OpenSSL (Apache 2.0) and libghostty (MIT) with its dependencies, and their licences ship in the app's Resources.

About

Text expansion and a connection manager for the Mac. Built for power users.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages