Electron app with audio-reactive fractal/abstract visuals on an external display. Dual-window setup (control panel + fullscreen output), 8 WebGL scenes, audio from file/live input/system audio, image and scrolling-text overlays. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
25 lines
1.0 KiB
JavaScript
25 lines
1.0 KiB
JavaScript
const { contextBridge, ipcRenderer, webUtils } = require('electron');
|
|
|
|
// Each window is launched with --role=control or --role=output.
|
|
const roleArg = process.argv.find(a => a.startsWith('--role='));
|
|
const role = roleArg ? roleArg.split('=')[1] : 'control';
|
|
|
|
contextBridge.exposeInMainWorld('djv', {
|
|
role,
|
|
// Control -> Output commands.
|
|
send: (msg) => ipcRenderer.send('ctl', msg),
|
|
onControl: (cb) => ipcRenderer.on('ctl', (_e, m) => cb(m)),
|
|
// Output -> Control reports.
|
|
report: (msg) => ipcRenderer.send('rpt', msg),
|
|
onReport: (cb) => ipcRenderer.on('rpt', (_e, m) => cb(m)),
|
|
// Display management (control window).
|
|
// Resolve a dropped/picked File to its absolute filesystem path.
|
|
pathForFile: (file) => {
|
|
try { return webUtils.getPathForFile(file); }
|
|
catch (e) { return file && file.path ? file.path : null; }
|
|
},
|
|
listDisplays: () => ipcRenderer.invoke('displays:list'),
|
|
moveOutputTo: (id) => ipcRenderer.invoke('output:moveTo', id),
|
|
toggleOutputFullscreen: () => ipcRenderer.invoke('output:toggleFullscreen')
|
|
});
|