memo-clipboard 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <div align="center">
2
- <img src="assets/memo.png" alt="Memo Logo" width="128" height="128" />
2
+ <img src="https://raw.githubusercontent.com/onursercanyilmaz/memo/main/assets/memo.png" alt="Memo Logo" width="120" height="120" />
3
3
  <h1>Memo</h1>
4
- <p><strong>Ultra-lightweight, blazing-fast open-source clipboard manager for Windows, macOS &amp; Linux — built with pure Rust.</strong></p>
4
+ <p><strong>Ultra-lightweight, blazing-fast native clipboard manager for Windows, macOS &amp; Linux — built with pure Rust.</strong></p>
5
5
 
6
6
  <p>
7
7
  <a href="https://onursercanyilmaz.github.io/memo/"><img src="https://img.shields.io/badge/Website-GitHub%20Pages-4F8CFF?style=flat-square" alt="Website" /></a>
@@ -14,152 +14,196 @@
14
14
  </p>
15
15
 
16
16
  <p>
17
+ <a href="#highlights">Highlights</a> •
17
18
  <a href="#installation">Installation</a> •
18
- <a href="#features">Features</a> •
19
- <a href="#memo-vs-ditto">Memo vs Ditto</a> •
19
+ <a href="#comparison">Comparison</a> •
20
20
  <a href="#keyboard-shortcuts">Shortcuts</a> •
21
21
  <a href="#privacy--security">Security</a> •
22
- <a href="#code-signing">Code Signing</a>
22
+ <a href="#building-from-source">Build</a>
23
23
  </p>
24
24
  </div>
25
25
 
26
26
  ---
27
27
 
28
- **Memo** is a modern, open-source alternative to **Ditto** for **Windows, macOS, and Linux**, written in **pure Rust**. On Windows it uses native **Win32 API + Direct2D/DirectWrite** (~1.5 MB single `.exe`, ~2.4 MB idle RAM, 0% idle CPU); on macOS and Linux it runs natively via **egui (`eframe`) + `arboard`**, sharing the same fast **SQLite + FTS5** core.
28
+ **Memo** is a modern, privacy-first, open-source clipboard manager written in **pure Rust** — designed with zero Electron/WebView bloat and instant keyboard-driven workflows across **Windows, macOS, and Linux**:
29
29
 
30
- ```text
31
- +----------------------------------------------------------------------+
32
- | Search... (Ctrl+V paste, Ctrl+A select, Up/Down) [*] [Gear] |
33
- | [All] [Pinned] [Text] [Image] [Link] [Files] [Work] [+ Folder] |
34
- +-----------------------------------+----------------------------------+
35
- | [KOD] fn main() { println!... [1]| Preview |
36
- | * Code.exe - 2m | ------------------------------- |
37
- | --------------------------------- | fn main() { |
38
- | [CLR] #4F8CFF [2]| println!("Hello Memo!"); |
39
- | Figma.exe - 5m | } |
40
- | --------------------------------- | |
41
- | [IMG] Image (1920x1080) [3]| ------------------------------- |
42
- | SnippingTool - 12m | Type: KOD | 38 chars | Code.exe |
43
- | | [Paste] [Plain] [Edit] [Pin] |
44
- +-----------------------------------+----------------------------------+
45
- ```
30
+ - **Windows:** Native **Win32 API + Direct2D / DirectWrite** (`~1.5 MB` single `.exe`, `~2.4 MB` idle RAM, `0%` idle CPU via `WM_CLIPBOARDUPDATE`).
31
+ - **macOS & Linux:** Native GPU-accelerated **egui (`eframe`)** + dedicated background worker (`0%` idle CPU via `NSPasteboard.changeCount()` on macOS, menu bar / system tray integration, and global hotkeys).
32
+ - **Shared Core:** Embedded **SQLite (WAL mode) + FTS5** full-text index with automatic substring fallback, deduplication, and retention protection.
46
33
 
47
- ---
34
+ <div align="center">
35
+ <img src="https://raw.githubusercontent.com/onursercanyilmaz/memo/main/assets/preview.png" alt="Memo Clipboard Manager UI Preview" width="820" />
36
+ </div>
48
37
 
49
- ## Features
38
+ ---
50
39
 
51
- - **Zero-Polling Native Listener:** Uses Win32 `AddClipboardFormatListener` (`WM_CLIPBOARDUPDATE`) — **0% CPU** when idle.
52
- - **Multi-Format Capture:** Plain text, code snippets, URLs, rich text (`HTML` / `RTF`), images (`PNG` stored on disk outside the DB), and file lists (`CF_HDROP`).
53
- - **Instant Auto-Paste:** Remembers your previous active window (`HWND`), hides on selection, restores focus, and simulates `Ctrl + V` via `SendInput`.
54
- - **Customizable Keybindings:** Built-in **Shortcut Recorder** in Settings (`⚙`) lets you assign any global hotkey (`Ctrl/Shift/Alt/Win + Key` or `F1–F12`) and customize every in-window shortcut.
55
- - **Folders & Pinning Protection:** Organize clips into custom folders or pin (`📌`) important snippets — pinned and folder-assigned items are **never deleted** by automatic retention cleanup.
56
- - **Multi-Select Merge Paste:** Hold `Ctrl + Click` or `Shift + Click` to select multiple items and paste them merged together in one shot.
57
- - **Inline Editing & Context Menu:** Press `Ctrl + E` (or right-click any card) to edit text clips in place (`Ctrl + S` to save), move to folders, pin, or paste as plain text.
40
+ ## Highlights
41
+
42
+ - **Zero-Stutter Background Architecture:**
43
+ - **Windows:** Event-driven `AddClipboardFormatListener` (`WM_CLIPBOARDUPDATE`) — zero polling.
44
+ - **macOS:** Dedicated background worker checking `NSPasteboard.changeCount()` in instant `O(1)` time with off-thread PNG encoding and zero idle UI repaints.
45
+ - **Multi-Format Capture & Restore:**
46
+ - Plain text, source code, URLs, rich text (`HTML` & `RTF`), images (`PNG` stored on disk outside SQLite with bounded GPU texture caching), and file copies (`CF_HDROP` on Windows, `NSFilenamesPboardType` in macOS Finder).
47
+ - **Instant Auto-Paste:**
48
+ - Remembers your previously active application, hides on selection, restores focus, and pastes automatically (`SendInput` on Windows, `CGEvent` `Cmd+V` on macOS, `xdotool` / `wtype` on Linux) — or strips formatting on the fly with `Shift + Enter`.
49
+ - **Live Shortcut Recorder:**
50
+ - Built-in **Shortcut Recorder** in Settings (`⚙`) lets you record any global toggle shortcut (`Ctrl` / `Shift` / `Alt·Option` / `Win·Cmd` + Key or `F1–F12`) or choose from presets.
51
+ - **Folders & Never-Delete Protection:**
52
+ - Organize clips into custom folders or pin (`📌`) important snippets. Pinned and folder-assigned clips are **never** removed by automatic retention limits or *Clear Unpinned History*.
53
+ - **Multi-Select Merge Paste & Inline Editor:**
54
+ - Select multiple clips with `Ctrl/Cmd + Click` or `Shift + Click` to merge-paste them in one shot, or press `Ctrl/Cmd + E` to edit any text/code clip inline (`Ctrl/Cmd + S` to save).
58
55
  - **Smart Previews:**
59
- - **Hex Colors (`#4F8CFF` / `#f0a`):** Live color swatches in both the list and preview pane.
60
- - **JSON:** Automatic pretty-printed preview.
61
- - **Links:** One-click `🌐 Open` button to launch URLs in your default browser.
62
- - **Dark & Light Themes:** Instant toggle, frameless rounded window (`DwmSetWindowAttribute`), draggable top bar, and system tray integration.
56
+ - **Hex Colors (`#4F8CFF` / `#f0a`):** Live color swatches in both the clip list and preview pane with RGB values.
57
+ - **JSON:** Automatic pretty-printed formatting.
58
+ - **Images:** Scaled high-DPI preview with dimensions and usage stats.
59
+ - **Links:** One-click `🌐 Open` button to open URLs in your default browser.
60
+ - **Bilingual UI & Themes:**
61
+ - Instant **Dark / Light** theme switch (`☀` / `🌙`) and built-in **English / Turkish (`EN` / `TR`)** interface toggle.
63
62
 
64
63
  ---
65
64
 
66
- ## Memo vs Ditto
67
-
68
- | Capability | Memo (v0.2.0) | Ditto |
69
- | :--- | :---: | :---: |
70
- | **Executable Size** | `~1.5 MB` (single `.exe`) | `~14 MB` installed |
71
- | **Idle Private RAM** | `~2.4 MB` | `~5–8 MB` |
72
- | **UI Engine** | Modern Two-Pane Direct2D + DirectWrite | Classic Win32 MFC List |
73
- | **Custom Global & In-App Key Recorder** | ✅ Built-in | ✅ |
74
- | **Folders & Never-Delete Protection** | ✅ | ✅ |
75
- | **Multi-Select Merge Paste** | ✅ | ✅ |
76
- | **Inline Clip Editing (`Ctrl+E`)** | ✅ | ✅ |
77
- | **Smart Hex Color & JSON Previews** | ✅ | ❌ |
78
- | **Password Manager Blacklist & Privacy Flags** | ✅ | Partial |
79
- | **Memory-Safe Core** | ✅ Pure Rust | C++ |
65
+ ## Comparison
66
+
67
+ | Capability | Memo (`v0.2.2`) | Ditto | Electron Clipboard Apps |
68
+ | :--- | :---: | :---: | :---: |
69
+ | **Platforms** | **Windows, macOS, Linux** | Windows only | Cross-platform |
70
+ | **Binary Size** | `~1.5 MB` (Win) / `~4.6 MB` (macOS) | `~14 MB` | `150–300+ MB` |
71
+ | **Idle CPU Usage** | **`0%`** (event / `changeCount` driven) | `0%` | `1–5%` |
72
+ | **UI Stack** | Native Direct2D (Win) / `egui` (Unix) | Win32 MFC | Chromium / WebView |
73
+ | **Rich Text (`HTML` / `RTF`) & Plain Paste** | ✅ | ✅ | Partial |
74
+ | **Custom Global Shortcut Recorder** | ✅ | ✅ | ✅ |
75
+ | **Folders & Retention Protection** | ✅ | ✅ | Varies |
76
+ | **Multi-Select Merge Paste & Inline Edit** | ✅ | ✅ | Partial |
77
+ | **Smart Hex Color, JSON & Image Previews** | ✅ | Image only | Partial |
78
+ | **OS Concealed Password & App Blacklist** | ✅ | Partial | Partial |
79
+ | **Memory-Safe Core** | ✅ Pure Rust | C++ | JS / C++ |
80
80
 
81
81
  ---
82
82
 
83
83
  ## Installation
84
84
 
85
- ### Option 1: Windows Installer (Recommended)
86
- Download **`Memo-Setup-vX.Y.Z.exe`** from [GitHub Releases](https://github.com/onursercanyilmaz/memo/releases):
87
- - Installs to `%LOCALAPPDATA%\Memo` (no admin rights required)
88
- - Creates a **Desktop shortcut** and Start Menu entry
89
- - Optional **Start with Windows** integration and clean uninstaller
85
+ ### Quick Install via npm / npx (Windows, macOS & Linux)
90
86
 
91
- ### Option 2: Portable Executable
92
- Download **`memo-windows-x64.exe`** from [GitHub Releases](https://github.com/onursercanyilmaz/memo/releases) and run it directly — zero installation required.
87
+ Requires [Node.js 18+](https://nodejs.org/). Ships prebuilt native binaries for `win32-x64`, `macos-arm64`, `macos-x64`, and `linux-x64` directly inside the package:
93
88
 
94
- ### Option 3: Install via npm (Node.js)
95
89
  ```bash
96
90
  npm install -g memo-clipboard
97
91
  memo
98
92
  ```
99
- Or run directly with `npx`:
93
+
94
+ Or launch directly without global installation:
95
+
100
96
  ```bash
101
97
  npx memo-clipboard
102
98
  ```
103
- *(Automatically downloads the latest Windows release binary on first run if not already installed.)*
104
99
 
105
- ### Option 4: One-Click Local Install (from source)
106
- ```powershell
107
- npm run install:windows
108
- # or directly:
109
- powershell -ExecutionPolicy Bypass -File scripts/install.ps1
110
- ```
100
+ The npm package ships **prebuilt native binaries** for `macos-arm64`, `macos-x64`, `linux-x64` and `windows-x64`, so it starts right away with no Rust toolchain and no extra download.
111
101
 
112
- ### Option 5: Build from Source (Pure Rust)
113
- ```powershell
114
- cargo test
115
- cargo build --release
116
- # Output: target/release/memo.exe
117
- ```
102
+ | Command | Description |
103
+ | :--- | :--- |
104
+ | `memo` | Start Memo in the background (it won't start a second copy if one is already running) |
105
+ | `memo --status` | Show process status, binary source and database path |
106
+ | `memo --doctor` | Check platform, binary, database and auto-paste support |
107
+ | `memo --restart` / `memo --stop` | Restart or stop the background instance |
108
+ | `memo --foreground` | Run attached to the terminal and show live logs |
109
+ | `memo --version` / `memo --help` | Show version / help |
110
+
111
+ ---
112
+
113
+ ### Windows
114
+
115
+ 1. **Installer (Recommended):** Download **`Memo-Setup-<version>.exe`** from [GitHub Releases](https://github.com/onursercanyilmaz/memo/releases).
116
+ - Installs per-user to `%LOCALAPPDATA%\Memo` (no administrator rights required).
117
+ - Creates Desktop & Start Menu shortcuts, optional *Start with Windows* entry, and clean uninstaller.
118
+ 2. **Portable:** Download **`memo-windows-x64.exe`** (or **`Memo-Portable-<version>.exe`**) and run directly.
119
+ 3. **PowerShell (from source):**
120
+ ```powershell
121
+ powershell -ExecutionPolicy Bypass -File scripts/install.ps1
122
+ ```
123
+
124
+ ---
125
+
126
+ ### macOS (Apple Silicon & Intel)
127
+
128
+ 1. Download **`Memo-<version>-arm64.dmg`** (Apple Silicon) or **`Memo-<version>-x64.dmg`** (Intel) from [GitHub Releases](https://github.com/onursercanyilmaz/memo/releases) and drag **Memo.app** to `/Applications`.
129
+ 2. **Unsigned Open-Source App Note:** If macOS Gatekeeper displays an unverified developer prompt on first launch, clear the quarantine attribute once:
130
+ ```bash
131
+ xattr -cr /Applications/Memo.app
132
+ ```
133
+ 3. **Auto-Paste Permission (Optional):** Memo runs as a clean menu bar app (`LSUIElement`). To enable automatic `Cmd + V` pasting into the previous window on `Enter`, grant permission under **System Settings → Privacy & Security → Accessibility** (a direct shortcut button is available inside Memo `⚙ Settings`).
134
+
135
+ ---
136
+
137
+ ### Linux (Debian / Ubuntu & AppImage)
138
+
139
+ - **Debian / Ubuntu (`.deb`):**
140
+ ```bash
141
+ sudo dpkg -i memo_<version>_amd64.deb
142
+ ```
143
+ - **Universal `.AppImage`:**
144
+ ```bash
145
+ chmod +x memo_<version>_x86_64.AppImage
146
+ ./memo_<version>_x86_64.AppImage
147
+ ```
148
+ - *Optional for Linux Auto-Paste:* Install `xdotool` (X11) or `wtype` (Wayland) so Memo can automatically send `Ctrl + V` to the target window.
118
149
 
119
150
  ---
120
151
 
121
152
  ## Keyboard Shortcuts
122
153
 
123
- | Shortcut | Action |
124
- | :--- | :--- |
125
- | `Ctrl + Shift + V` | Toggle Memo window *(customizable in `⚙ Settings`)* |
126
- | `Enter` | Paste selected item (or merge multiple selected items) |
127
- | `Shift + Enter` | Paste as **plain text** (strips HTML/RTF formatting) |
128
- | `Ctrl + C` | Copy to clipboard without pasting |
129
- | `Ctrl + E` | Edit selected text/code clip inline (`Ctrl + S` to save) |
130
- | `Ctrl + P` | Pin / Unpin item |
131
- | `Alt + 1..9` | Quick-paste top 9 items |
132
- | `Ctrl + A` / `Ctrl + V` | Select all / Paste inside search box |
133
- | `Delete` | Delete selected item |
134
- | `Esc` | Clear search, cancel edit, or hide window |
154
+ | Shortcut (Windows / Linux) | Shortcut (macOS) | Action |
155
+ | :--- | :--- | :--- |
156
+ | `Ctrl + Shift + V` | `Ctrl + Shift + V` *(customizable)* | Toggle Memo window from anywhere |
157
+ | `Up` / `Down` | `Up` / `Down` | Navigate clipboard history |
158
+ | `Enter` | `Enter` | Paste selected item (or merge-paste multi-selection) |
159
+ | `Shift + Enter` | `Shift + Enter` | Paste as **plain text** (strips HTML/RTF or pastes file paths) |
160
+ | `Ctrl + C` | `Cmd + C` | Copy selected item without hiding |
161
+ | `Ctrl + E` | `Cmd + E` | Edit selected text/code clip inline |
162
+ | `Ctrl + S` | `Cmd + S` | Save inline edit |
163
+ | `Ctrl + P` | `Cmd + P` | Pin / Unpin selected clip |
164
+ | `Alt + 1..9` | `Option + 1..9` | Quick-paste top 9 clips |
165
+ | `Ctrl + Click` / `Shift + Click` | `Cmd + Click` / `Shift + Click` | Multi-select clips for merge paste |
166
+ | `Delete` | `Delete` / `Cmd + Backspace` | Delete selected clip |
167
+ | `Esc` | `Esc` | Cancel edit → clear search → hide window |
135
168
 
136
169
  ---
137
170
 
138
171
  ## Privacy & Security
139
172
 
140
- - **100% Local & Offline:** All clipboard history is stored locally in `%APPDATA%\memo\memo.db` and `%APPDATA%\memo\images\`. Zero telemetry, zero network calls.
141
- - **OS Privacy Compliance:** Automatically ignores clipboard entries marked with `ExcludeClipboardContentFromMonitorProcessing`, `Clipboard Viewer Ignore`, or `CanIncludeInClipboardHistory = 0`.
142
- - **App Blacklist:** Skips password managers (`keepass.exe`, `keepassxc.exe`, `1password.exe`, `bitwarden.exe`) by default (configurable in `%APPDATA%\memo\settings.json`).
143
- - **Legal & Policies:** [Privacy Policy](https://onursercanyilmaz.github.io/memo/privacy.html) · [Terms of Use & Disclaimer](https://onursercanyilmaz.github.io/memo/terms.html)
173
+ - **100% Local & Offline:** Memo makes **zero** network requests and collects **zero** telemetry. History is stored exclusively on your device:
174
+ - **Windows:** `%APPDATA%\memo\memo.db` & `%APPDATA%\memo\images\`
175
+ - **macOS:** `~/Library/Application Support/memo/memo.db` & `images/`
176
+ - **Linux:** `${XDG_DATA_HOME:-~/.local/share}/memo/memo.db` & `images/`
177
+ - **OS Concealed Clipboard Compliance:**
178
+ - **Windows:** Ignores `ExcludeClipboardContentFromMonitorProcessing`, `Clipboard Viewer Ignore`, and `CanIncludeInClipboardHistory = 0`.
179
+ - **macOS:** Ignores `org.nspasteboard.ConcealedType`, `org.nspasteboard.TransientType`, `org.nspasteboard.AutoGeneratedType`, and `com.agilebits.onepassword`.
180
+ - **Password Manager Blacklist:** Automatically skips captures from `1Password`, `Bitwarden`, `KeePass`, `KeePassXC`, Apple `Passwords`, and `Keychain Access` (fully customizable in `⚙ Settings` or `settings.json`).
181
+ - **Policies:** [Privacy Policy](https://onursercanyilmaz.github.io/memo/privacy.html) · [Terms of Use & Disclaimer](https://onursercanyilmaz.github.io/memo/terms.html)
144
182
 
145
183
  ---
146
184
 
147
- ## Code Signing
185
+ ## Building from Source
148
186
 
149
- > Free code signing provided by **[SignPath.io](https://signpath.io/)**, certificate by **[SignPath Foundation](https://signpath.org/)**.
187
+ ### Prerequisites
150
188
 
151
- Our release pipeline (`.github/workflows/release.yml`) is integrated with SignPath.io so signed release binaries eliminate the Windows SmartScreen *"Unknown Publisher"* warning.
189
+ - **Rust 1.80+** (`rustup`)
190
+ - **Linux (Ubuntu/Debian) system headers:**
191
+ ```bash
192
+ sudo apt-get update
193
+ sudo apt-get install -y \
194
+ libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
195
+ libxkbcommon-dev libgtk-3-dev libxdo-dev libayatana-appindicator3-dev
196
+ ```
152
197
 
153
- <details>
154
- <summary>Maintainer setup to activate SignPath.io signing on GitHub Actions</summary>
198
+ ### Test, Lint & Build
155
199
 
156
- 1. Register the open-source project `onursercanyilmaz/memo` at [SignPath.io](https://about.signpath.io/product/open-source).
157
- 2. Add the following in **GitHub Repository Settings → Secrets and variables → Actions**:
158
- - **Secret:** `SIGNPATH_API_TOKEN`
159
- - **Variables:** `SIGNPATH_ORGANIZATION_ID`, `SIGNPATH_PROJECT_SLUG` (default: `memo`), `SIGNPATH_SIGNING_POLICY_SLUG` (default: `release-signing`).
160
- 3. Push a new tag (`git tag v0.2.1 && git push --tags`) — signed `Memo-Setup-*.exe` and `memo-windows-x64.exe` will be published automatically.
200
+ ```bash
201
+ cargo test
202
+ cargo clippy --all-targets -- -D warnings
203
+ cargo build --release
204
+ ```
161
205
 
162
- </details>
206
+ The optimized binary is written to `target/release/memo` (`target\release\memo.exe` on Windows).
163
207
 
164
208
  ---
165
209
 
@@ -168,23 +212,33 @@ Our release pipeline (`.github/workflows/release.yml`) is integrated with SignPa
168
212
  ```text
169
213
  memo/
170
214
  ├── src/
171
- │ ├── main.rs # Win32 message loop, single-instance guard, tray & hotkey routing
172
- │ ├── ui.rs # Software Direct2D / DirectWrite UI, settings, key recorder, context menu
173
- │ ├── db.rs # Bundled SQLite + FTS5 schema, folders, retention cleanup
174
- │ ├── clipboard.rs # Win32 clipboard listener, multi-format read/write, PNG image & privacy filters
175
- │ ├── paste.rs # Global RegisterHotKey, focus capture/restore, SendInput Ctrl+V
176
- │ ├── tray.rs # System tray icon & context menu
177
- │ └── config.rs # JSON settings, keybindings, Windows Registry autostart
178
- ├── assets/ # App icon (memo.ico & memo.png)
179
- ├── docs/ # GitHub Pages landing site
180
- ├── bin/memo.js # Node.js CLI wrapper
181
- ├── installer/memo.iss # Inno Setup Windows installer script (Desktop shortcut + uninstaller)
182
- ├── scripts/install.ps1# Local PowerShell installer (Desktop + Start Menu shortcuts)
183
- └── .github/workflows/ # CI, GitHub Pages, SignPath.io code signing & Release automation
215
+ │ ├── main.rs # Entry point & Win32 message loop routing
216
+ │ ├── db.rs # SQLite (WAL) + FTS5/LIKE hybrid search, folders & retention
217
+ │ ├── config.rs # Settings, keybindings & cross-platform autostart (Registry / LaunchAgents / XDG)
218
+ │ ├── ui.rs # Windows native Direct2D + DirectWrite two-pane UI
219
+ │ ├── clipboard.rs # Windows clipboard listener, DIB/HTML/RTF/HDROP & privacy filters
220
+ │ ├── paste.rs # Windows RegisterHotKey, focus restore & SendInput Ctrl+V
221
+ │ ├── tray.rs # Windows system tray icon & context menu
222
+ │ ├── unix_app.rs # macOS & Linux egui UI, shortcut recorder, bilingual EN/TR & caching
223
+ │ ├── unix_clipboard.rs # Off-thread clipboard worker, PNG encoder & IgnoreHash loop guard
224
+ │ └── unix_platform.rs # macOS NSPasteboard/NSWorkspace/CGEvent FFI & Linux xdotool/wtype integration
225
+ ├── assets/ # Application icons (memo.png & memo.ico)
226
+ ├── bin/memo.js # Zero-dependency Node.js cross-platform binary launcher
227
+ ├── docs/ # GitHub Pages website, privacy policy & terms
228
+ ├── installer/memo.iss # Inno Setup per-user Windows installer script
229
+ ├── scripts/install.ps1 # Local PowerShell build & shortcut installer
230
+ ├── build.rs # Windows executable icon resource compiler
231
+ └── .github/workflows/ # Multi-OS CI, GitHub Releases (.exe/.dmg/.deb/.AppImage + npm) & Pages
184
232
  ```
185
233
 
186
234
  ---
187
235
 
236
+ ## Code Signing
237
+
238
+ > Windows code signing policy is prepared for **[SignPath.io](https://signpath.io/)** (certificate by **[SignPath Foundation](https://signpath.org/)**). Until organization signing credentials are active on a release tag, Windows SmartScreen or macOS Gatekeeper may show a standard prompt for unsigned open-source binaries.
239
+
240
+ ---
241
+
188
242
  ## License
189
243
 
190
- [MIT](LICENSE)
244
+ Released under the [MIT License](LICENSE).
Binary file
package/bin/memo.js CHANGED
@@ -8,108 +8,417 @@ const os = require("os");
8
8
  const path = require("path");
9
9
 
10
10
  const rootDir = path.resolve(__dirname, "..");
11
+ const pkg = JSON.parse(
12
+ fs.readFileSync(path.join(rootDir, "package.json"), "utf8")
13
+ );
14
+ const VERSION = pkg.version || "0.2.2";
11
15
  const isWin = process.platform === "win32";
12
16
  const isMac = process.platform === "darwin";
13
17
 
14
18
  function getAssetName() {
15
19
  if (isWin) return "memo-windows-x64.exe";
16
- if (isMac) return process.arch === "arm64" ? "memo-macos-arm64" : "memo-macos-x64";
20
+ if (isMac) {
21
+ return process.arch === "arm64" ? "memo-macos-arm64" : "memo-macos-x64";
22
+ }
17
23
  return "memo-linux-x64";
18
24
  }
19
25
 
20
- function getInstallPath() {
26
+ function getDataDir() {
21
27
  if (isWin) {
22
- return path.join(process.env.LOCALAPPDATA || rootDir, "Memo", "memo.exe");
28
+ return path.join(process.env.APPDATA || os.homedir(), "memo");
29
+ }
30
+ if (isMac) {
31
+ return path.join(os.homedir(), "Library", "Application Support", "memo");
23
32
  }
24
- return path.join(os.homedir(), ".local", "bin", "memo");
33
+ return path.join(
34
+ process.env.XDG_DATA_HOME || path.join(os.homedir(), ".local", "share"),
35
+ "memo"
36
+ );
25
37
  }
26
38
 
27
- const releaseExe = path.join(
39
+ function getCacheExePath() {
40
+ const asset = getAssetName();
41
+ if (isWin) {
42
+ const base = process.env.LOCALAPPDATA || path.join(os.homedir(), ".memo");
43
+ return path.join(base, "Memo", "bin", `v${VERSION}`, asset);
44
+ }
45
+ return path.join(os.homedir(), ".memo", "bin", `v${VERSION}`, asset);
46
+ }
47
+
48
+ const prebuiltExe = path.join(rootDir, "prebuilds", getAssetName());
49
+ const cargoReleaseExe = path.join(
28
50
  rootDir,
29
51
  "target",
30
52
  "release",
31
53
  isWin ? "memo.exe" : "memo"
32
54
  );
33
- const installedExe = getInstallPath();
34
- const RELEASE_URL = `https://github.com/onursercanyilmaz/memo/releases/latest/download/${getAssetName()}`;
55
+ const cachedExe = getCacheExePath();
35
56
 
36
- function findExecutable() {
37
- if (fs.existsSync(releaseExe)) return releaseExe;
38
- if (fs.existsSync(installedExe)) return installedExe;
57
+ function ensureExecutableMode(filePath) {
58
+ if (!isWin) {
59
+ try {
60
+ fs.chmodSync(filePath, 0o755);
61
+ } catch {
62
+ // ignore on read-only mounts
63
+ }
64
+ }
65
+ }
66
+
67
+ function resolveBinary() {
68
+ if (fs.existsSync(prebuiltExe)) {
69
+ ensureExecutableMode(prebuiltExe);
70
+ return { path: prebuiltExe, source: "bundled npm prebuild" };
71
+ }
72
+ if (fs.existsSync(cargoReleaseExe)) {
73
+ ensureExecutableMode(cargoReleaseExe);
74
+ return { path: cargoReleaseExe, source: "local cargo release" };
75
+ }
76
+ if (fs.existsSync(cachedExe)) {
77
+ ensureExecutableMode(cachedExe);
78
+ return { path: cachedExe, source: "cached release binary" };
79
+ }
39
80
  return null;
40
81
  }
41
82
 
83
+ // Process names Memo can run under (cargo build, npm prebuild, or .app bundle)
84
+ const UNIX_NAMES = new Set(["memo", "memo-macos-arm64", "memo-macos-x64", "memo-linux-x64"]);
85
+ const WIN_NAMES = ["memo.exe", "memo-windows-x64.exe"];
86
+
87
+ function getRunningPids() {
88
+ try {
89
+ if (isWin) {
90
+ const out = execSync("tasklist /FO CSV /NH", {
91
+ encoding: "utf8",
92
+ stdio: ["ignore", "pipe", "ignore"],
93
+ });
94
+ const pids = [];
95
+ for (const line of out.split(/\r?\n/)) {
96
+ const cols = line.split('","').map((c) => c.replace(/"/g, ""));
97
+ if (cols.length > 1 && WIN_NAMES.includes(cols[0].toLowerCase())) {
98
+ pids.push(parseInt(cols[1], 10));
99
+ }
100
+ }
101
+ return pids;
102
+ }
103
+ const out = execSync("ps -axo pid=,comm=", {
104
+ encoding: "utf8",
105
+ stdio: ["ignore", "pipe", "ignore"],
106
+ });
107
+ const pids = [];
108
+ for (const line of out.split("\n")) {
109
+ const m = line.trim().match(/^(\d+)\s+(.+)$/);
110
+ if (m && UNIX_NAMES.has(path.basename(m[2])) && parseInt(m[1], 10) !== process.pid) {
111
+ pids.push(parseInt(m[1], 10));
112
+ }
113
+ }
114
+ return pids;
115
+ } catch {
116
+ return [];
117
+ }
118
+ }
119
+
120
+ function getRunningPid() {
121
+ const pids = getRunningPids();
122
+ return pids.length ? pids[0] : null;
123
+ }
124
+
125
+ function stopRunningInstance() {
126
+ const pids = getRunningPids();
127
+ for (const pid of pids) {
128
+ try {
129
+ process.kill(pid);
130
+ } catch {
131
+ // already exited
132
+ }
133
+ }
134
+ return pids.length > 0;
135
+ }
136
+
42
137
  function downloadFile(url, dest, redirectsLeft = 5) {
43
138
  return new Promise((resolve, reject) => {
44
139
  https
45
- .get(url, { headers: { "User-Agent": "memo-clipboard-cli" } }, (res) => {
46
- if (
47
- res.statusCode >= 300 &&
48
- res.statusCode < 400 &&
49
- res.headers.location &&
50
- redirectsLeft > 0
51
- ) {
52
- res.resume();
53
- return resolve(
54
- downloadFile(res.headers.location, dest, redirectsLeft - 1)
55
- );
56
- }
57
- if (res.statusCode !== 200) {
58
- res.resume();
59
- return reject(new Error(`HTTP ${res.statusCode}`));
140
+ .get(
141
+ url,
142
+ { headers: { "User-Agent": `memo-clipboard/${VERSION}` } },
143
+ (res) => {
144
+ if (
145
+ res.statusCode >= 300 &&
146
+ res.statusCode < 400 &&
147
+ res.headers.location &&
148
+ redirectsLeft > 0
149
+ ) {
150
+ res.resume();
151
+ return resolve(
152
+ downloadFile(res.headers.location, dest, redirectsLeft - 1)
153
+ );
154
+ }
155
+ if (res.statusCode !== 200) {
156
+ res.resume();
157
+ return reject(new Error(`HTTP ${res.statusCode}`));
158
+ }
159
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
160
+ const tmpDest = `${dest}.tmp-${process.pid}`;
161
+ const file = fs.createWriteStream(tmpDest);
162
+ res.pipe(file);
163
+ file.on("finish", () => {
164
+ file.close(() => {
165
+ try {
166
+ if (!isWin) fs.chmodSync(tmpDest, 0o755);
167
+ fs.renameSync(tmpDest, dest);
168
+ resolve();
169
+ } catch (e) {
170
+ reject(e);
171
+ }
172
+ });
173
+ });
174
+ file.on("error", (err) => {
175
+ fs.unlink(tmpDest, () => reject(err));
176
+ });
60
177
  }
61
- fs.mkdirSync(path.dirname(dest), { recursive: true });
62
- const file = fs.createWriteStream(dest);
63
- res.pipe(file);
64
- file.on("finish", () => {
65
- file.close(() => {
66
- if (!isWin) {
67
- fs.chmodSync(dest, 0o755);
178
+ )
179
+ .on("error", reject);
180
+ });
181
+ }
182
+
183
+ function checkNpmUpdate() {
184
+ return new Promise((resolve) => {
185
+ try {
186
+ const req = https.get(
187
+ "https://registry.npmjs.org/memo-clipboard/latest",
188
+ { timeout: 1800 },
189
+ (res) => {
190
+ if (res.statusCode !== 200) {
191
+ res.resume();
192
+ return resolve();
193
+ }
194
+ let raw = "";
195
+ res.on("data", (c) => (raw += c));
196
+ res.on("end", () => {
197
+ try {
198
+ const latest = JSON.parse(raw)?.version;
199
+ if (latest && latest !== "0.0.0-stage" && latest !== VERSION) {
200
+ const a = latest.split(".").map((n) => parseInt(n, 10) || 0);
201
+ const b = VERSION.split(".").map((n) => parseInt(n, 10) || 0);
202
+ const newer =
203
+ a[0] > b[0] ||
204
+ (a[0] === b[0] && a[1] > b[1]) ||
205
+ (a[0] === b[0] && a[1] === b[1] && a[2] > b[2]);
206
+ if (newer) {
207
+ console.log(
208
+ `> Update available: ${VERSION} -> ${latest} (run: npm i -g memo-clipboard@latest)`
209
+ );
210
+ }
211
+ }
212
+ } catch {
213
+ // ignore parse errors
68
214
  }
69
215
  resolve();
70
216
  });
71
- });
72
- file.on("error", (err) => {
73
- fs.unlink(dest, () => reject(err));
74
- });
75
- })
76
- .on("error", reject);
217
+ }
218
+ );
219
+ req.on("error", () => resolve());
220
+ req.on("timeout", () => {
221
+ req.destroy();
222
+ resolve();
223
+ });
224
+ } catch {
225
+ resolve();
226
+ }
77
227
  });
78
228
  }
79
229
 
80
- async function main() {
81
- let exePath = findExecutable();
230
+ function printHelp() {
231
+ console.log(`
232
+ Memo v${VERSION} — Ultra-lightweight native Rust clipboard manager
233
+
234
+ Usage:
235
+ memo [options]
236
+ npx memo-clipboard [options]
237
+
238
+ Options:
239
+ -f, --foreground Run attached to the current terminal (shows live logs)
240
+ --restart Restart Memo if an instance is already running
241
+ --stop Stop the running Memo background instance
242
+ --status Show process status, binary source, and database path
243
+ --doctor Run environment & platform capability diagnostics
244
+ --reinstall Download a fresh native binary from GitHub Releases
245
+ -v, --version Print version and target platform
246
+ -h, --help Show this help message
247
+ `);
248
+ }
82
249
 
83
- if (!exePath && fs.existsSync(path.join(rootDir, "Cargo.toml"))) {
84
- console.log("[memo] Building release binary with cargo...");
250
+ function runDoctor() {
251
+ const resolved = resolveBinary();
252
+ const dataDir = getDataDir();
253
+ const dbFile = path.join(dataDir, "memo.db");
254
+ const pid = getRunningPid();
255
+
256
+ console.log(`Memo Doctor (v${VERSION})`);
257
+ console.log(` Platform : ${process.platform}-${process.arch}`);
258
+ console.log(` Expected Bin : ${getAssetName()}`);
259
+ console.log(
260
+ ` Binary Path : ${resolved ? `${resolved.path} (${resolved.source})` : "not installed yet"}`
261
+ );
262
+ console.log(` Process : ${pid ? `running (PID ${pid})` : "stopped"}`);
263
+ console.log(
264
+ ` Database : ${dbFile} (${fs.existsSync(dbFile) ? `${(fs.statSync(dbFile).size / 1024).toFixed(1)} KB` : "will be created on first launch"})`
265
+ );
266
+
267
+ if (isMac) {
268
+ console.log(
269
+ " macOS Note : Grant Accessibility in System Settings -> Privacy & Security for automatic Cmd+V paste."
270
+ );
271
+ } else if (!isWin) {
272
+ let hasXdotool = false;
273
+ let hasWtype = false;
85
274
  try {
86
- execSync("cargo build --release", { cwd: rootDir, stdio: "inherit" });
87
- exePath = findExecutable();
88
- } catch {
89
- // Fall back to downloading from GitHub Releases
275
+ execSync("command -v xdotool", { stdio: "ignore" });
276
+ hasXdotool = true;
277
+ } catch {}
278
+ try {
279
+ execSync("command -v wtype", { stdio: "ignore" });
280
+ hasWtype = true;
281
+ } catch {}
282
+ console.log(
283
+ ` Auto-Paste : xdotool=${hasXdotool ? "yes" : "no"}, wtype=${hasWtype ? "yes" : "no"}`
284
+ );
285
+ }
286
+ }
287
+
288
+ async function ensureBinary(forceDownload = false) {
289
+ if (!forceDownload) {
290
+ const existing = resolveBinary();
291
+ if (existing) return existing;
292
+
293
+ if (fs.existsSync(path.join(rootDir, "Cargo.toml"))) {
294
+ console.log("> Building Memo release binary with cargo...");
295
+ try {
296
+ execSync("cargo build --release", { cwd: rootDir, stdio: "inherit" });
297
+ const built = resolveBinary();
298
+ if (built) return built;
299
+ } catch {
300
+ // fall through to GitHub Releases download
301
+ }
90
302
  }
91
303
  }
92
304
 
93
- if (!exePath) {
94
- console.log(`[memo] Downloading ${getAssetName()} from GitHub Releases...`);
95
- try {
96
- await downloadFile(RELEASE_URL, installedExe);
97
- exePath = installedExe;
98
- console.log(`[memo] Installed to ${installedExe}`);
99
- } catch (err) {
100
- console.error(`[memo] Failed to download binary: ${err.message}`);
101
- console.error(
102
- "[memo] Download manually from: https://github.com/onursercanyilmaz/memo/releases"
305
+ const asset = getAssetName();
306
+ const versionedUrl = `https://github.com/onursercanyilmaz/memo/releases/download/v${VERSION}/${asset}`;
307
+ const latestUrl = `https://github.com/onursercanyilmaz/memo/releases/latest/download/${asset}`;
308
+
309
+ console.log(`> Downloading ${asset} (v${VERSION}) from GitHub Releases...`);
310
+ try {
311
+ await downloadFile(versionedUrl, cachedExe);
312
+ } catch {
313
+ await downloadFile(latestUrl, cachedExe);
314
+ }
315
+ console.log(`> Saved native binary to ${cachedExe}`);
316
+ return { path: cachedExe, source: "downloaded release binary" };
317
+ }
318
+
319
+ async function main() {
320
+ const args = process.argv.slice(2);
321
+
322
+ if (args.includes("-h") || args.includes("--help")) {
323
+ printHelp();
324
+ return;
325
+ }
326
+
327
+ if (args.includes("-v") || args.includes("--version")) {
328
+ console.log(`memo-clipboard v${VERSION} (${process.platform}-${process.arch})`);
329
+ return;
330
+ }
331
+
332
+ if (args.includes("--doctor")) {
333
+ runDoctor();
334
+ return;
335
+ }
336
+
337
+ if (args.includes("--status")) {
338
+ const pid = getRunningPid();
339
+ const resolved = resolveBinary();
340
+ const dbFile = path.join(getDataDir(), "memo.db");
341
+ console.log(
342
+ pid ? `> Memo is running (PID ${pid})` : "> Memo is not currently running"
343
+ );
344
+ if (resolved) {
345
+ console.log(`> Binary: ${resolved.path} (${resolved.source})`);
346
+ }
347
+ console.log(`> Data directory: ${getDataDir()}`);
348
+ if (fs.existsSync(dbFile)) {
349
+ console.log(
350
+ `> Database size: ${(fs.statSync(dbFile).size / 1024).toFixed(1)} KB`
103
351
  );
104
- process.exit(1);
105
352
  }
353
+ return;
354
+ }
355
+
356
+ if (args.includes("--stop")) {
357
+ const stopped = stopRunningInstance();
358
+ console.log(
359
+ stopped ? "> Stopped running Memo instance." : "> Memo was not running."
360
+ );
361
+ return;
106
362
  }
107
363
 
108
- const child = spawn(exePath, process.argv.slice(2), {
364
+ const forceReinstall = args.includes("--reinstall");
365
+ const foreground = args.includes("-f") || args.includes("--foreground");
366
+ const restart = args.includes("--restart");
367
+
368
+ let binInfo;
369
+ try {
370
+ binInfo = await ensureBinary(forceReinstall);
371
+ } catch (err) {
372
+ console.error(`[memo] Failed to obtain native binary: ${err.message}`);
373
+ console.error(
374
+ "[memo] Download manually from: https://github.com/onursercanyilmaz/memo/releases"
375
+ );
376
+ process.exit(1);
377
+ }
378
+
379
+ const existingPid = getRunningPid();
380
+ if (existingPid && !restart && !foreground) {
381
+ console.log(`> Memo v${VERSION} is already running (PID ${existingPid})`);
382
+ console.log(`> Data directory: ${getDataDir()}`);
383
+ console.log(`> Tip: Press Ctrl + Shift + V to toggle Memo, or pass --restart`);
384
+ await checkNpmUpdate();
385
+ return;
386
+ }
387
+
388
+ if (existingPid && restart) {
389
+ stopRunningInstance();
390
+ await new Promise((r) => setTimeout(r, 400));
391
+ }
392
+
393
+ const passArgs = args.filter(
394
+ (a) =>
395
+ ![
396
+ "-f",
397
+ "--foreground",
398
+ "--restart",
399
+ "--reinstall",
400
+ ].includes(a)
401
+ );
402
+
403
+ if (foreground) {
404
+ console.log(`> Starting Memo v${VERSION} in foreground (${binInfo.source})...`);
405
+ const child = spawn(binInfo.path, passArgs, { stdio: "inherit" });
406
+ child.on("exit", (code) => process.exit(code ?? 0));
407
+ return;
408
+ }
409
+
410
+ const child = spawn(binInfo.path, passArgs, {
109
411
  detached: true,
110
412
  stdio: "ignore",
111
413
  });
112
414
  child.unref();
415
+
416
+ console.log(`> Memo v${VERSION} started (PID ${child.pid})`);
417
+ console.log(`> Binary: ${binInfo.path} (${binInfo.source})`);
418
+ console.log(`> Data directory: ${getDataDir()}`);
419
+ console.log(`> Toggle shortcut: Ctrl + Shift + V (customizable in Settings)`);
420
+
421
+ await checkNpmUpdate();
113
422
  }
114
423
 
115
424
  main();
package/package.json CHANGED
@@ -1,36 +1,56 @@
1
1
  {
2
2
  "name": "memo-clipboard",
3
- "version": "0.2.0",
4
- "description": "Ultra-lightweight, native cross-platform clipboard manager written in pure Rust (Windows, macOS, Linux)",
5
- "main": "bin/memo.js",
6
- "bin": {
7
- "memo": "bin/memo.js"
8
- },
3
+ "version": "0.2.2",
4
+ "description": "Ultra-lightweight, blazing-fast native clipboard manager for Windows, macOS & Linux written in pure Rust — SQLite + FTS5 search, rich text, images, folders, themes & instant auto-paste.",
5
+ "author": "Onur Sercan Yılmaz <onursercanyilmaz@users.noreply.github.com>",
6
+ "license": "MIT",
7
+ "homepage": "https://onursercanyilmaz.github.io/memo/",
9
8
  "repository": {
10
9
  "type": "git",
11
10
  "url": "git+https://github.com/onursercanyilmaz/memo.git"
12
11
  },
13
- "homepage": "https://onursercanyilmaz.github.io/memo/",
14
12
  "bugs": {
15
13
  "url": "https://github.com/onursercanyilmaz/memo/issues"
16
14
  },
15
+ "main": "bin/memo.js",
16
+ "bin": {
17
+ "memo": "./bin/memo.js",
18
+ "memo-clipboard": "./bin/memo.js"
19
+ },
20
+ "files": [
21
+ "bin/**/*",
22
+ "prebuilds/**/*",
23
+ "assets/**/*",
24
+ "scripts/install.ps1",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
17
28
  "scripts": {
18
29
  "start": "node bin/memo.js",
30
+ "status": "node bin/memo.js --status",
31
+ "doctor": "node bin/memo.js --doctor",
19
32
  "build": "cargo build --release",
20
- "test": "cargo test",
33
+ "test": "cargo test && node -c bin/memo.js && node -c scripts/prepare-npm.js",
34
+ "prepare:npm": "node scripts/prepare-npm.js",
35
+ "prepublishOnly": "node scripts/prepare-npm.js",
21
36
  "install:windows": "powershell -ExecutionPolicy Bypass -File scripts/install.ps1"
22
37
  },
23
38
  "keywords": [
24
39
  "clipboard",
25
40
  "clipboard-manager",
26
- "rust",
41
+ "clipboard-history",
42
+ "macos",
27
43
  "windows",
28
- "direct2d",
44
+ "linux",
45
+ "rust",
46
+ "menu-bar",
47
+ "system-tray",
29
48
  "ditto-alternative",
30
- "productivity"
49
+ "maccy-alternative",
50
+ "paste",
51
+ "productivity",
52
+ "cli"
31
53
  ],
32
- "author": "Onur Sercan Yilmaz",
33
- "license": "MIT",
34
54
  "engines": {
35
55
  "node": ">=18.0.0"
36
56
  },
Binary file
Binary file
Binary file
Binary file