添加到 Chrome 应用标题栏

Add to Chrome app titlebar

我想在 Chrome 应用程序的标题栏中添加一个按钮。我的大部分研究让我相信,唯一的方法是禁用默认标题栏并制作我自己的标题栏。有没有办法简单地向现有标题栏添加一个按钮?如果没有,是否有资源包含删除默认标题栏和制作自定义标题栏的详细教程或示例?

不,没有办法将按钮添加到 "default" 标题栏。反正那也不是便携的。

您可以做的是创建一个无框架应用程序 window:

chrome.app.runtime.onLaunched.addListener(function() {
  chrome.app.window.create('window.html', {
    'outerBounds': {
      'width': 400,
      'height': 500
    },
    'frame': 'none' // It will be a rectangle filled with your HTML
  });
});

有一个sample app that implements this and also a draggable标题栏。

您可以使用任何类型的框架在页面顶部创建一个看起来像标题栏的区域,例如 Bootstrap 的 navbar, and implement actions like close/maximize/minimize using chrome.app.window API - get a reference to the current AppWindow and use its methods