reactjstypescriptelectroncustom-titlebar

Custom-Electron-Titlebar removeMenuBar typescript issue


I'm having an issue with with react and typescript while building an electron app. I'm trying to set up custom-electron-titlebar with my app. For the most part its working fine. However, i have run into webstorm telling me...

TS2353: Object literal may only specify known properties, and removeMenuBar does not exist in type TitleBarOption

When i look at the code sure enough there is no "removeMenuBar" on the interface. I assume this was removed for some reason or another but the docs was never updated. Can someone help explain to me how i can remove the menu bar from the titlebar? I have searched and searched and come up empty handed.

import { Titlebar, TitlebarColor } from "custom-electron-titlebar";

window.addEventListener("DOMContentLoaded", () => {
    new Titlebar({
        backgroundColor: TitlebarColor.fromHex("#000000"),
        titleHorizontalAlignment: "center",
        menuTransparency: 100,
        removeMenuBar: true,
    });
});

Solution

  • The library custom-electron-titlebar is archived, meaning it's not longer maintained. The README is up to date, but not the latest version of the library published on npm. The latter was published on Jan 15 2024, while the functionality you want (added via this PR) has been merged on May 11 2024.

    If you still want to use this library anyway, you need to install it from github directly:

    npm install "https://github.com/AlexTorresDev/custom-electron-titlebar.git#main" --save
    

    More details on this question.

    Note that because the library uses pnpm, if you use Yarn Berry, then you won't be able to do that because of this issue (or this one).