项目作者: AlexTorresSk

项目描述 :
Custom electon title bar inpire on VS Code title bar
高级语言: TypeScript
项目地址: git://github.com/AlexTorresSk/custom-electron-titlebar.git
创建时间: 2018-12-16T13:18:08Z
项目社区:https://github.com/AlexTorresSk/custom-electron-titlebar

开源协议:MIT License

下载


Custom Electron Titlebar

This project is a typescript library for electron that allows you to configure a fully customizable title bar.

CI
License
NPM
Install size

[!IMPORTANT]
This project will no longer be maintained, because I am the only one working on it and I have no free time left to review the issues and incorporate new features or update the dependencies to the latest versions.

Thanks to all the contributors and dependents of this library.

📄 Documentation

Standard Title Bar

Screenshot 1

Bottom Menu Bar

Screenshot 2

Menu

Screenshot 3

Custom color

Screenshot 4

📦 Installing

You can install this package with npm, pnpm or yarn.

  1. npm install custom-electron-titlebar
  1. pnpm add custom-electron-titlebar
  1. yarn add custom-electron-titlebar

🛠️ Usage

The implementation is done as follows:

In the main application file (main.js or .ts)

  1. import { setupTitlebar, attachTitlebarToWindow } from "custom-electron-titlebar/main";
  2. // setup the titlebar main process
  3. setupTitlebar();
  4. function createWindow() {
  5. // Create the browser window.
  6. const mainWindow = new BrowserWindow({
  7. width: 800,
  8. height: 600,
  9. //frame: false, // needed if process.versions.electron < 14
  10. titleBarStyle: 'hidden',
  11. /* You can use *titleBarOverlay: true* to use the original Windows controls */
  12. titleBarOverlay: true,
  13. webPreferences: {
  14. sandbox: false,
  15. preload: path.join(__dirname, 'preload.js')
  16. }
  17. });
  18. ...
  19. // attach fullScreen(f11 and not 'maximized') && focus listeners
  20. attachTitlebarToWindow(mainWindow);
  21. }

In the preload file (preload.js or .ts)

  1. import { Titlebar } from "custom-electron-titlebar";
  2. window.addEventListener('DOMContentLoaded', () => {
  3. // Title bar implementation
  4. new Titlebar();
  5. });

To see the options you can include in the Title Bar constructor, such as color of elements, icons, menu position, and much more, and the methods you can use, go to the wiki

💰 Support

If you want to support my development, you can do so by donating through 💖 Sponsor

📝 Contributors

I would like to express my sincere gratitude to all the people who have collaborated in the development and advancement of this project. I appreciate your contributions.

✅ License

This project is under the MIT license.