javascript - Chrome Extension: creating window at the size of the default (Ctrl+N) browser window? -


i writing google chrome extension managing tabs (inspired tabs outliner, chrome 60 broke). have popup window showing previously-closed browser windows , tabs:

screenshot

when click on "saved window", event handler calls

chrome.windows.create(         {             url: urls,     // array of urls of tabs, here ['https://demozoo.org']             focused: true         },         function(win) {             // callback code omitted         } ); 

that works, resulting window same size popup, not same size normal browser window if hit ctrl+n. how can create window @ ctrl+n size instead?

some workarounds:

edit suggested woxxom, if there window open, can use chrome.windows.get() size , position, create @ size. however, looking solution work when there no window open other popup itself. in situation, chrome.windows.getall() returns popup. however, size of last-closed (non-popup?) window saved somewhere, because ctrl+n in popup window open window @ size, not popup's size.

edit 2 suggested mayken, can track size of closed window manually, trapping chrome.windows onremoved events. (i have track oncreated for, e.g., after chrome startup, before window has been closed.) however, since chrome tracks this, wondering if can read chrome's value rather duplicating effort.

original if inspect popup, in console, can run

chrome.windows.create() 

and window same size normal window. however, if provide url, e.g.:

chrome.windows.create({url:'about:blank'}) 

the window has size of parent popup. workaround, can use chrome.windows.create() , manually add tabs 1 @ time chrome.tabs.create(). however, keep convenience of urls: [...] parameter if possible.

alternatively, create empty window chrome.windows.create(), size, close it, , open new window specified size. not big fan of risk of flicker, though.

i have looked online , can't find way access default size or create window urls @ default size. information in profile's preferences file per this answer, can't find reliable, cross-platform way build file:// url profile directory. cannot find api in list looks provides profile information.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -