I am able to create a new window with my app, but I was wondering if there was a way for this window to open at the bottom of the screen. The preferred behavior would be, given a height, fill in a window from the left to right side of the screen and be all the way at the bottom of that screen. Like a bottom-docked panel.

Is there some attribute I can add to the create to make this happen? All I can think is to set left to 0, but that only solves one thing.

chrome.app.window.create("window.html", {
  alwaysOnTop: true,
  id: "info_view",
  bounds: {width:600, height:400},
});

The app window create reference is here: https://developer.chrome.com/apps/app_window#type-CreateWindowOptions

有帮助吗?

解决方案

First, It looks like bounds is deprecated; you should use innerBounds or outerBounds instead.

Second, all of the bounds take a BoundsSpecification which has arguments for left and top. You can get the screen display bounds using chrome.system.display.getInfo(function callback) which returns a workArea (and a bounds, depending on your intent).

Then, probably you want to pass to window.create something like

outerBounds: {
  top: screenInfo.workArea.height - window_height,
  height: window_height
}

(Note: I haven't tried it, yet)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top