Electron App Mac Window Same Color As Background

/ Comments off

Implementation

The MainWindow class constructor expects an object as first parameter. In order to make our window transparent, we need to provide the transparent and frame property to true and false respectively:

  • Oct 03, 2018  I nevertheless built with the latest Windows 10 — hopefully the forced updates to Windows 10 that get pushed down to users will keep your Electron-Python apps compatible with a.
  • Jan 04, 2019  Also these apps work for multiple platforms like Windows, Mac, Linux and so on. Electron combines Chromium and NodeJS into a single runtime. This enables us to run the HTML, CSS and Javascript code as a desktop application. Electron Forge. If Electron is used directly, then some manual setup is needed before building your application.

Tipically, if the transparent windows is meant to be the unique and initial, then you should make the changes in the main.js file:

And execute the project using npm start, your app will look like: As you can see, the window is totally transparent and you can see VSCode at the background. You can not click through the transparent area. We are going to introduce an API to set window shape to solve this, see the issue for details. Transparent windows are not.

That should make already your window transparent. Set as content of your index.html file the following markup:

and execute the project using npm start, your app will look like:

As you can see, the window is totally transparent and you can see VSCode at the background.

Limitations

  • You can not click through the transparent area. We are going to introduce an API to set window shape to solve this, see the issue for details.
  • Transparent windows are not resizable. Setting resizable to true may make a transparent window stop working on some platforms.
  • The blur filter only applies to the web page, so there is no way to apply blur effect to the content below the window (i.e. other applications open on the user's system).
  • On Windows operating systems, transparent windows will not work when DWM is disabled.
  • On Linux users have to put --enable-transparent-visuals --disable-gpu in the command line to disable GPU and allow ARGB to make transparent window, this is caused by an upstream bug that alpha channel doesn't work on some NVidia drivers on Linux.
  • On Mac the native window shadow will not be shown on a transparent window.
Electron App Mac Window Same Color As Background

Important notes

If the developer tools area is visible, the window won't be transparent anymore. If it's hidden or it's not shown then the transparent effect will be kept.

As probably no one wants a static window that can't be moved, allow the drag feature to an element by using CSS:

By adding the draggable-area class to any element, it will allow the user to drag the entire window from that point. On some platforms, the draggable area will be treated as a non-client frame, so when you right click on it a system menu will pop up. To make the context menu behave correctly on all platforms you should never use a custom context menu on draggable areas.

Example

The following document will make a very simple transparent window with a couple of button actions and a draggable area:

The previous markup should generate an app like:

Have fun !

Background and Requirements

Windows 10 'Anniversary Update' is able to run win32 .exe binaries bylaunching them together with a virtualized filesystem and registry. Both arecreated during compilation by running app and installer inside a WindowsContainer, allowing Windows to identify exactly which modifications to theoperating system are done during installation. Pairing the executable with avirtual filesystem and a virtual registry allows Windows to enable one-clickinstallation and uninstallation.

In addition, the exe is launched inside the appx model - meaning that it can usemany of the APIs available to the Universal Windows Platform. To gain even morecapabilities, an Electron app can pair up with an invisible UWP background tasklaunched together with the exe - sort of launched as a sidekick to run tasksin the background, receive push notifications, or to communicate with other UWPapplications.

To compile any existing Electron app, ensure that you have the followingrequirements:

  • Windows 10 with Anniversary Update (released August 2nd, 2016)
  • The Windows 10 SDK, downloadable here
  • At least Node 4 (to check, run node -v)

Electron App Mac Window Same Color As Background Free

Then, go and install the electron-windows-store CLI: