After hiding the default title bar (because it doesn't look good), we lose the functionality of double clicking. There's no proper way to do it with electron, so I detect the double click on the top bar and manually activate the correct action. Clickable elements on the top bar have to stop propagation of the double click so users don't maximize by mistake.
Details
- Test if double click to (un)maximize works
- Change mac settings and check if minimize works
- Change mac settings and check if "Do nothing" does nothing
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
I think it would be good for @kamil to review this too – he's looking at ENG-1687: Explore sqlite-worker NPM package, which is related to ENG-1685: Stateful web client, which I think has some connection to the Electron app. Given this overlap I think it makes sense for @michal to review @kamil's diffs in the space, and for @kamil to review @michal's diffs in the space.
desktop/main.js | ||
---|---|---|
52–71 ↗ | (On Diff #18424) | It would be a good idea to link to a place where this was discussed https://github.com/electron/electron/issues/16385 |
web/app.react.js | ||
189–198 ↗ | (On Diff #18424) | Can we avoid defining arrow functions on every render? |
Don't define arrow functions on every render, move the doubleClick callbacks to the <header>.
Looks good!
Would be great to add a brief comment explaining the possible scenarios in ipcMain.on('double-click-top-bar', () => { before landing. It took me a second + some googling to figure what was going on there
desktop/main.cjs | ||
---|---|---|
99–110 ↗ | (On Diff #18551) | Based on some Googling, it looks like the possible values of AppleActionOnDoubleClick are: Maximize, Minimize, or None. Looks like mine is set to Maximize and so these Mac-specific options get skipped and if (win.isMaximized()) { win.unmaximize(); } else { win.maximize(); } is the behavior that ends up being relevant. Should we maybe jot down a comment explaining the defaults + possible values of AppleActionOnDoubleClick to clarify things for future readers? It might be clear to others but it took me a second to understand the possible scenarios here. |
web/app.react.js | ||
---|---|---|
195 ↗ | (On Diff #18551) | We can access the style as a property when it doesn't have any special chars |