custom electron titlebar
v4.2.8
该项目是用于电子的打字稿库,允许您配置完全可自定义的标题栏。
重要的
该项目将不再维护,因为我是唯一一个从事该项目的项目,而且我没有空闲时间来查看问题并包含新功能或将依赖项更新为最新版本。
感谢该库的所有贡献者和家属。
?文档




您可以使用npm , pnpm或yarn安装此软件包。
npm install custom-electron-titlebarpnpm add custom-electron-titlebaryarn add custom-electron-titlebar实现如下:
在主要应用程序文件(main.js或.ts)中
import { setupTitlebar , attachTitlebarToWindow } from "custom-electron-titlebar/main" ;
// setup the titlebar main process
setupTitlebar ( ) ;
function createWindow ( ) {
// Create the browser window.
const mainWindow = new BrowserWindow ( {
width : 800 ,
height : 600 ,
//frame: false, // needed if process.versions.electron < 14
titleBarStyle : 'hidden' ,
/* You can use *titleBarOverlay: true* to use the original Windows controls */
titleBarOverlay : true ,
webPreferences : {
sandbox : false ,
preload : path . join ( __dirname , 'preload.js' )
}
} ) ;
...
// attach fullScreen(f11 and not 'maximized') && focus listeners
attachTitlebarToWindow ( mainWindow ) ;
}在预加载文件(PRELOAD.JS或.TS)中
import { Titlebar } from "custom-electron-titlebar" ;
window . addEventListener ( 'DOMContentLoaded' , ( ) => {
// Title bar implementation
new Titlebar ( ) ;
} ) ;要查看您可以在标题栏构造函数中包含的选项,例如元素,图标,菜单位置等的颜色,以及您可以使用的方法,请转到Wiki
如果您想支持我的发展,可以通过捐款来做到这一点?赞助
我要对所有在该项目发展和进步中合作的人表示衷心的感谢。感谢您的贡献。
该项目属于麻省理工学院许可证。