Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize the window title bar of an Electron app?

Tags:

I'm getting started working with Electron to build a desktop app. How can I customize the window title bar (which contains the close, minimize, and full screen buttons) to add custom views? Safari is an example that I am thinking of:

safar title bar

like image 868
Andrew Avatar asked Feb 26 '16 19:02

Andrew


People also ask

How do you customize the title bar of an Electron?

Your only option in Electron would be to create a frameless (aka borderless) window, and then create a "fake" title bar with CSS, including any UI elements you need. Show activity on this post. Then you could use the css properties -webkit-user-select and -webkit-app-region to specify the drag zone.

How do you change the color of the title bar of an Electron?

There's no way at the moment to customize the native titlebar. So, first step is to hide the native titlebar by telling your BrowserWindow to hide the frame (that would also hide the menubar). Then, you should create your custom titlebar (or import a third party library like 1 or 2) in HTML, CSS and JS.

How do I remove the menu bar from my Electron app?

To remove menu bar from Electron app, we can set the autoHideMenuBar to true . to create a BrowserWindow instance by passing in an object with autoHideMenuBar set to true . As a result, the menu bar would be hidden in the app.


Video Answer


1 Answers

Your only option in Electron would be to create a frameless (aka borderless) window, and then create a "fake" title bar with CSS, including any UI elements you need.

Electron/webkit provides CSS properties that allows you to make any element draggable, like a titlebar:

.titlebar {   -webkit-user-select: none;   -webkit-app-region: drag; } 
like image 164
Teak Avatar answered Sep 18 '22 12:09

Teak