Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron: Drag tab into another open window

Tags:

I am creating a electron application that looks similar to google chrome with multiple dynamic tabs for different pages. The application also supports multiple open windows. I want to be able to drag tabs between these windows. I already know how to send messages between my windows with the ipcRenderer but I am coming up against a few roadblocks:

1) I cannot drag an html element outside of a window. How can I drag the tab (or something that looks identical) outside of the window?

I've found a discussion on the atom forums where someone claimed they were able to achieve this, but do not elaborate on how. They claim "Native HTML5 Drag and Drop in combination with IPC messaging was the solution". Someone else links a GitHub example below, but the example has since been removed.

2) How do I detect when a tab is dragged onto another open window (Mouse released on other window)?

Again the discussion suggests I use IPC messaging to do this, but I have not found a way to get the id of the window you release the mouse on.

Edit:

I have found a solution to issue 1. The mentioned discussion was right and using default HTML5 dragging behavior was able to create the effect I wanted. Issue 2 still stumps me. I understand the concept of alerting all other open windows with an IPC message to prepare for an incoming drag but I am still unsure how to get the id of the window and the position you dragged to on it so you can send the tab information to the correct place.