Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rounded corners on an Electron app?

I am currently trying to get rounded corners on an Electron application I'm making. I have tried nearly every solution available on-line at the moment, but none of them make any difference.

How can I round the corners of my Electron app?

like image 331
Cody Thompson Avatar asked Jul 10 '18 10:07

Cody Thompson


1 Answers

Make a frameless transparent window

const myWindow = new BrowserWindow({
    transparent: true, 
    frame: false
})

And have something like this in the renderer, or apply the style directly to the body tag

<div style="width: 500px; height: 500px; border-radius: 5px">My window content</div>

Just make sure to also add a custom window titlebar that has -webkit-app-region: dragin order to make the window dragable from this element.

Check out the Electron Docs for further informations ;) https://github.com/electron/electron/blob/master/docs/api/frameless-window.md#transparent-window

like image 71
Hans Koch Avatar answered Nov 13 '22 16:11

Hans Koch