From e1d66d8a2ff22543e5b3d38d4797af0f0690d4d4 Mon Sep 17 00:00:00 2001 From: jazzymc Date: Sun, 8 Nov 2026 09:19:11 +0000 Subject: [PATCH] macget, shared syncmap table, Finder push hotkeys Drag and drop now works both ways. macget turns a Mac path into a file readable here: translated for free if it is in a Syncthing-shared folder, fetched over ssh otherwise, into appdata rather than the RAM rootfs. It takes every form a drag produces - plain path, escaped spaces, file:// URL, ~/... Cmd+Shift+F and Cmd+Ctrl+F push the current Finder selection to a chosen or the last-used terminal, sharing that target with the screenshot hotkeys. They need Automation permission for Finder; without it the AppleEvent hangs and fails -1712 while the hotkey appears to do nothing. Two fixes recorded: the shared-folder table is no longer duplicated between omac and macget, and the scp remote path must not be quoted in SFTP mode, which is the opposite of what omac's ssh calls need. Co-Authored-By: Claude Opus 5 --- docs/12-DEVELOPMENT-ENVIRONMENT.md | 5 ++++- docs/14-HERDR-REMOTE-MACHINES.md | 8 ++++++++ docs/CHANGELOG.md | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/12-DEVELOPMENT-ENVIRONMENT.md b/docs/12-DEVELOPMENT-ENVIRONMENT.md index 539d2c7..af4371e 100644 --- a/docs/12-DEVELOPMENT-ENVIRONMENT.md +++ b/docs/12-DEVELOPMENT-ENVIRONMENT.md @@ -287,8 +287,11 @@ cmd`, cron — never sources `.bashrc` but does inherit `PATH`. | `shot` | Name the files `hc put` dropped into this Herdr terminal | | `omac` | Act on an Unraid file as its Mac counterpart: open, path, `file://` URL, OSC 8 link, or verify it has synced | | `clip` | Put text into the Mac's pasteboard from a session here, over OSC 52 | +| `macget` | Turn a Mac path (as a drag onto the terminal produces) into a file readable here | -`omac` translates through the shared Syncthing folders. The Unraid paths in +`omac` and `macget` translate through the shared Syncthing folders, using one +table at `/boot/config/shell/syncmap` so the two directions cannot drift. The +Unraid paths in Syncthing's `config.xml` are *container* paths and must be resolved through the `syncthing` container's mounts (`/data1` → `/mnt/user/projects`): diff --git a/docs/14-HERDR-REMOTE-MACHINES.md b/docs/14-HERDR-REMOTE-MACHINES.md index 0a289e7..2632e1c 100644 --- a/docs/14-HERDR-REMOTE-MACHINES.md +++ b/docs/14-HERDR-REMOTE-MACHINES.md @@ -258,6 +258,14 @@ Appended to `~/.hammerspoon/init.lua` on 2026-11-08 (160 → 266 lines, backup |-----|--------| | `Cmd+Shift+U` | Clipboard image, or capture a region if there is none; pick a terminal; push and prompt | | `Cmd+Ctrl+U` | The same, straight to the terminal chosen last time | +| `Cmd+Shift+F` | Push whatever is selected in Finder; pick a terminal | +| `Cmd+Ctrl+F` | Push the Finder selection to the terminal chosen last time | + +The F pair takes several files at once and skips folders. It shares its "last +terminal" with the U pair. **It needs Automation permission** — on first use +macOS asks to let Hammerspoon control Finder, and until that is allowed the +AppleEvent hangs and fails with `-1712` while the hotkey appears to do nothing. +The screenshot hotkeys need no permission. It runs `hc put --json `, parses the returned path, then `hc send "Look at the screenshot at "` so the agent is told diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 90f1c64..5dbd299 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,6 +11,9 @@ - **[HOST]** New `clip` (`shell/bin/clip` → `/root/.local/bin/clip`) puts text into the Mac's pasteboard by writing an OSC 52 escape to this session's pty — no ssh, no mount, no sync. Walks up the process tree to find a pty, since a tool call or pipeline has none of its own, and wraps for tmux passthrough when `$TMUX` is set. OSC 52 has no reply, so a `clipboard-write = deny` refusal cannot be detected from here. - **[HOST]** Screenshot hotkey appended to the Mac's `~/.hammerspoon/init.lua` (160 → 266 lines, backup kept): `Cmd+Shift+U` picks a terminal and pushes the clipboard image, `Cmd+Ctrl+U` repeats to the last one. The picker lists every live terminal on **both** machines, because `hc ls` from the Mac addresses local terminals as `t7` and this box's as `unraid/t13`. Verified end to end — a PNG made here, sent to the Mac, pushed back with `hc put`, named by `shot` and read in-session byte-intact. - **[HOST]** Documented that `screencapture` cannot work over ssh (`could not create image from rect`): macOS withholds Screen Recording permission from a non-GUI session. Screen capture belongs to Hammerspoon, in the GUI session. +- **[HOST]** Drag and drop, both directions. `macget` (`shell/bin/macget` → `/root/.local/bin/macget`) turns a Mac path — what Ghostty inserts when a file is dragged onto the terminal — into a file readable here: translated for free if it is in a shared folder, fetched over ssh otherwise, into `/mnt/user/appdata/shell/macget/` on the NVMe rather than the RAM rootfs. Accepts a plain path, backslash-escaped spaces, a percent-encoded `file://` URL and `~/…`. On the Mac side `Cmd+Shift+F` / `Cmd+Ctrl+F` push the current Finder selection to a chosen or the last-used terminal; they need Automation permission for Finder, and without it the AppleEvent hangs and fails `-1712` while the hotkey looks dead. +- **[FIXED]** The shared-folder table was duplicated between `omac` and `macget`. It is now one file, `/boot/config/shell/syncmap`, read by both — the same reasoning that puts `env.sh` and `aliases.sh` under both shells. +- **[FIXED]** Every `macget` fetch failed with `No such file or directory` because the remote path was quoted with `${p@Q}`. `scp` in SFTP mode passes the path as data, not through a remote shell, so the quotes became part of the filename. `omac` quotes its paths and is right to — those reach a remote shell via `ssh`. An initial guess that the Mac had no SFTP subsystem was wrong: it is set in `/etc/ssh/sshd_config.d/100-macos.conf`, which a grep of `sshd_config` alone misses. - **[NOTE]** `hc` is 0.1.18 on the Mac and 0.1.17 here. ---