Nir
Nir

Reputation: 483

Chrome packaged app window, resizes itself when I minimize - then maximize the window

I've built a chrome packaged app and for some reason when I minimize the window and maximize it again, the window size is changed (becomes smaller both width and height)! Looks like when the window is resized, the entire window including the frame changes to the size I wanted only the content to be.

In background.js, I open the window as follows:

chrome.app.runtime.onLaunched.addListener(function () {
    chrome.app.window.create('index.html', {
        id: 'appWindow',
        width: 400,
        height: 520,
        minWidth: 400,
        minHeight: 520,
        maxWidth: 400,
        maxHeight: 520,
        resizable: false
    });
});

I've tried using 'bounds' as well (with width/height in it), but it did not help. Any thoughts?

Upvotes: 0

Views: 654

Answers (1)

Nir
Nir

Reputation: 483

I was not able to fix this 'nicely', but I do have a workaround.

In my app.js (not background.js), I added:

chrome.app.window.current().onRestored.addListener(function () {
    chrome.app.window.get('appWindow').outerBounds.setSize(400, 520);
});

That resets the window size when restored. I will post a chrome bug for this later on today.

Thanks for the help, Xan.

Upvotes: 2

Related Questions