Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

ac-electron: experimental 'Launch Native Notepat' tray item (macOS)

Wires a tray hook that spawns a macOS ac-native binary with notepat.mjs.
ac-native is currently Linux-only bare metal — when a mac target is built
and dropped at one of these paths it just starts working:

1. $AC_NATIVE_BIN
2. <repo>/fedac/native/build/ac-native-macos
3. <repo>/fedac/native/build/ac-native
4. /usr/local/bin/ac-native

Until then, the menu item shows a dialog explaining how to install.

Appears under Experimental in the AC tray, and directly under 'Open
Notepat Overlay' in the Notepat tray. Disabled on non-macOS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+93 -1
+93 -1
ac-electron/main.js
··· 730 730 getFocusedWindow()?.webContents.send('navigate', `${baseUrl}/${piece}?nogap=true`); 731 731 } 732 732 733 + // ========== Experimental: native notepat (macOS) ========== 734 + // ac-native is currently a Linux-only bare-metal runtime (see fedac/native/). 735 + // A macOS build doesn't exist yet — when someone adds one and drops the 736 + // resulting Mach-O at any of the paths below (or points $AC_NATIVE_BIN at 737 + // it), the tray item "Launch Native Notepat" starts working automatically. 738 + // Until then, clicking the item shows an installation hint dialog. 739 + function resolveNativeBinary() { 740 + const repoRoot = path.resolve(__dirname, '..'); 741 + const candidates = [ 742 + process.env.AC_NATIVE_BIN, 743 + path.join(repoRoot, 'fedac', 'native', 'build', 'ac-native-macos'), 744 + path.join(repoRoot, 'fedac', 'native', 'build', 'ac-native'), 745 + '/usr/local/bin/ac-native', 746 + ].filter(Boolean); 747 + for (const p of candidates) { 748 + try { 749 + if (fs.statSync(p).isFile()) return { path: p, candidates }; 750 + } catch (_) { /* not found, keep looking */ } 751 + } 752 + return { path: null, candidates }; 753 + } 754 + 755 + function launchNativeNotepat() { 756 + if (process.platform !== 'darwin') { 757 + dialog.showMessageBox({ 758 + type: 'info', 759 + title: 'macOS only', 760 + message: 'Native notepat is a macOS-only experimental feature.', 761 + }); 762 + return; 763 + } 764 + const { path: binPath, candidates } = resolveNativeBinary(); 765 + if (!binPath) { 766 + dialog.showMessageBox({ 767 + type: 'warning', 768 + title: 'ac-native binary not found', 769 + message: 'No macOS build of ac-native is installed.', 770 + detail: 771 + 'ac-native is currently Linux-only bare metal. To enable this menu item, ' + 772 + 'build a macOS target from fedac/native/ (no Makefile target exists yet) and ' + 773 + 'drop the Mach-O binary at one of these paths, or point $AC_NATIVE_BIN at it:\n\n' + 774 + candidates.map((p) => ' • ' + p).join('\n'), 775 + }); 776 + return; 777 + } 778 + const repoRoot = path.resolve(__dirname, '..'); 779 + const pieceFile = path.join(repoRoot, 'fedac', 'native', 'pieces', 'notepat.mjs'); 780 + try { 781 + console.log('[native-notepat] spawning:', binPath, pieceFile); 782 + const child = spawn(binPath, [pieceFile], { 783 + detached: true, 784 + stdio: 'ignore', 785 + }); 786 + child.on('error', (err) => { 787 + console.warn('[native-notepat] spawn error:', err); 788 + dialog.showMessageBox({ 789 + type: 'error', 790 + title: 'Native notepat failed to start', 791 + message: err.message, 792 + }); 793 + }); 794 + child.unref(); 795 + } catch (err) { 796 + dialog.showMessageBox({ 797 + type: 'error', 798 + title: 'Native notepat failed to start', 799 + message: err.message, 800 + }); 801 + } 802 + } 803 + 733 804 // ========== System Tray ========== 734 805 let tray = null; 735 806 let notepatTray = null; ··· 1119 1190 }); 1120 1191 1121 1192 menuItems.push({ type: 'separator' }); 1122 - 1193 + 1194 + // Experimental section — things that may or may not work depending on 1195 + // what's installed on the host machine. 1196 + menuItems.push({ 1197 + label: 'Experimental', 1198 + submenu: [ 1199 + { 1200 + label: 'Launch Native Notepat (macOS)', 1201 + enabled: process.platform === 'darwin', 1202 + click: () => launchNativeNotepat(), 1203 + }, 1204 + ], 1205 + }); 1206 + 1207 + menuItems.push({ type: 'separator' }); 1208 + 1123 1209 menuItems.push({ 1124 1210 label: 'Quit', 1125 1211 accelerator: isMac ? 'Cmd+Q' : 'Alt+F4', ··· 1161 1247 const menu = Menu.buildFromTemplate([ 1162 1248 { label: 'Open Notepat', click: open }, 1163 1249 { label: 'Open Notepat Overlay 🪟', click: () => openNotepatOverlayWindow() }, 1250 + { type: 'separator' }, 1251 + { 1252 + label: 'Launch Native Notepat (experimental)', 1253 + enabled: process.platform === 'darwin', 1254 + click: () => launchNativeNotepat(), 1255 + }, 1164 1256 { type: 'separator' }, 1165 1257 { 1166 1258 label: 'Overlay: Click-Through',