theseus/panel-grip-preload.js

13 lines
715 B
JavaScript
Raw Normal View History

// Resize grip for the left panel (quick-link web apps and add-on panels).
// The panel itself may be a third-party page (WhatsApp, Telegram…), so the
// grip is a separate view of Theseus's own laid over the panel's right edge.
// While dragging, main stretches this view over the whole window so every
// mousemove and the final mouseup land here, wherever the pointer goes.
const { contextBridge, ipcRenderer } = require("electron");
contextBridge.exposeInMainWorld("grip", {
start: () => ipcRenderer.invoke("panel-grip-start"),
move: (windowX) => ipcRenderer.invoke("panel-grip-move", windowX),
end: () => ipcRenderer.invoke("panel-grip-end"),
reset: () => ipcRenderer.invoke("panel-grip-reset"),
});