Noufal Binu

How to make Frame less Electron Desktop App

Last updated on : November 8th, 2021

Title: Building Frameless Electron Desktop Apps: A Step-by-Step Guide

Electron is a powerful framework that allows developers to create cross-platform desktop applications using web technologies such as HTML, CSS, and JavaScript. One of the common requirements for desktop apps is to have a frameless or borderless window, providing a clean and modern user interface. In this article, we’ll walk you through the process of building a frameless Electron desktop app, enabling you to create sleek and immersive user experiences.

Step 1: Set Up Your Development Environment
Before getting started, ensure you have Node.js and npm (Node Package Manager) installed on your machine. Create a new directory for your project and navigate to it using the command line. Initiate a new Node.js project by running the command: npm init.

Step 2: Install Electron
Next, install Electron by running the following command: npm install electron. This will add Electron as a dependency in your project. Electron provides a prebuilt package that includes everything you need to develop and run Electron apps.

Step 3: Create the Main Application Window
Inside your project directory, create a new JavaScript file, such as main.js, and open it in a text editor. In this file, you will define the main process of your Electron app. Add the following code to create a frameless windows

const { app, BrowserWindow } = require('electron');

function createWindow() {
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    frame: false, // Set frame option to false
    // Add other window options and configurations as needed

  // Load your app's HTML file

  // Add any additional logic or event listeners

  // Clean up resources when the window is closed
  mainWindow.on('closed', () => {
    mainWindow = null;

// App ready event
app.on('ready', createWindow);

// Add additional app event listeners and logic

This code snippet creates a new Electron window with the frame option set to false, which removes the default window frame and title bar.

Step 4: Customize the Window Appearance
To create a visually appealing frameless window, you can use CSS to style the HTML content of your app. Create an index.html file in your project directory and add the necessary HTML and CSS to define the layout and appearance of your app. Utilize CSS properties like border-radius and box-shadow to create rounded corners and drop shadows for your window.

Step 5: Handle Window Controls
Without the default window frame, you’ll need to implement your own window controls, such as minimize, maximize, and close buttons. This can be achieved using HTML, CSS, and JavaScript. Create buttons in your HTML file and add event listeners to handle the corresponding actions, such as minimizing or closing the app window. Use Electron’s remote module to interact with the main process and control the window’s behavior.

Step 6: Package and Distribute Your App
Once you have built and tested your frameless Electron app, it’s time to package and distribute it to users. Electron provides tools like electron-packager and electron-builder that simplify the packaging process and generate platform-specific executables or installers. Follow the documentation and guidelines provided by these tools to create distribution-ready packages for Windows, macOS, and Linux.

Creating a frameless Electron desktop app allows you to design modern and immersive user interfaces that blend seamlessly with the user’s operating system. By following the steps outlined in this guide, you can harness the power of Electron and web technologies to build feature-rich desktop applications with sleek and customized window designs. Experiment with different styles, explore additional Electron features, and continuously enhance your app’s functionality to create a remarkable user experience.




Written by noufal

Noufal specialize in crafting tailor-made WordPress Themes and Plugins, leveraging my 6 years of experience in web development. Feel free to explore my portfolio to get a glimpse of my work. My passion lies in creating unique and custom websites, and I’ve successfully completed numerous website projects throughout my career.

Leave a Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Lets have a personal and meaningful conversation.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>