Chrome Packaged App and Dual Monitors

眉间皱痕 提交于 2019-11-27 15:05:22

问题


I am working on a packaged app that will use multiple displays. I need to be able to open windows in specific displays. I've also tried opening windows and then, using javascript, moving them to a monitor. But the app will not move any further than the bounds of the active display.

Any ideas on how to get this to work?


回答1:


Use chrome.system.display.getInfo with this you can get the display info for each active display.

With displayInfo.workArea you can get the working area of each display, you just have to think of one big display and each display is a workArea. With this information you can move your window with

AppWindow#setBounds to the correct monitor. Be carfull, AppWindow#moveTo is not working.




回答2:


Use AppWindow#setBounds

E.g.

chrome.app.window.get('mainWindow').setBounds({"height": 200, "left": 2000})

Tested on v34

Boom. Change this to correct answer.




回答3:


This was not the solution I was hoping for but as one of the comments mentioned there is a bug with Chrome and multiple monitors. In my case this is an internal application so I'm able to install anything i need to make this work.

My solution was to create a console application which launches the chrome app and then moves the windows around using the Windows32 API. Obviously not ideal but it works and the user still just needs one click to launch the app.




回答4:


You can write a chrome extension to get this done. In the Background script you can listen to chrome.windows.onCreated event and use chrome.windows.update function to move the windows to other monitors



来源:https://stackoverflow.com/questions/17328295/chrome-packaged-app-and-dual-monitors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!