Open Bug 1424084 Opened 7 years ago Updated 2 years ago

Method to listen for changes in window state

Categories

(WebExtensions :: General, enhancement, P5)

58 Branch
enhancement

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: george.bateman16, Unassigned)

Details

(Whiteboard: [design-decision-approved])

The browser.windows API currently allows us to listen for window creation, closure and focus changes. It would be great if we could also listen for window resizing and state changes (i.e. between maximized and restored). My usecase for this is an attempt to duplicate https://addons.mozilla.org/en-GB/firefox/addon/htitle/ using a WebExtension and a Python script; this had an option to display the titlebar only if the window was not maximized.
Component: General → WebExtensions: Untriaged
Product: Firefox → Toolkit
Priority: -- → P5
Summary: Request: WebExtensions method to listen for changes in window state → Method to listen for changes in window state
Whiteboard: [design-decision-needed]
Hi George, this has been added to the agenda for the February 20, 2018 WebExtensions APIs triage. Would you be able to join us? Here’s a quick overview of what to expect at the triage: * We normally spend 5 minutes per bug * The more information in the bug, the better * The goal of the triage is to give a general thumbs up or thumbs down on a proposal; we won't be going deep into implementation details Relevant Links: * Wiki for the meeting: https://wiki.mozilla.org/WebExtensions/Triage#Next_Meeting * Meeting agenda: https://docs.google.com/document/d/1-edU5RRFo2TupsOW400AcTOj8yyQnXd0F7uSsqkEzck/edit# * Vision doc for WebExtensions: https://wiki.mozilla.org/WebExtensions/Vision
Yes! Something like this would be useful/helpful: browser.windows.onUpdated.addListener((windowId, updateInfo, windowInfo) => { // do something here }); The updateInfo will be the same as https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/windows/update#Parameters
I vote for this. It would be incredibly useful for my Tile Tabs WE add-on. This would allow much more efficient management of the tiled layout. At present, Tile Tabs WE has to poll every 100ms to determine if any of the tiled windows have changed size or position.
This request has been approved. There was discussion around the best design for this, whether an onUpdated listener similar to the one that tabs use is the best, or whether listeners specific to the events of interest (e.g. onResize, onMaximize, etc.) might make more sense especially from a performance point-of-view. That is an engineering design TBD prior to implementation.
Whiteboard: [design-decision-needed] → [design-decision-approved]
If we use my method, can we also have a filter template like tabs.onUpdated [1]? To improve performance? [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1329507
Flags: needinfo?(mconca)
Thanks for the suggestion kernp25. When we get to the engineering design of this, we'll make sure we consider that.
Flags: needinfo?(mconca)
Product: Toolkit → WebExtensions
Component: Untriaged → General
Severity: normal → S3

Maybe you have also interest in this bug?

Flags: needinfo?(gp3033)

(In reply to kernp25 from comment #8)

Maybe you have also interest in this bug?

I'll add it to my queue

Flags: needinfo?(gp3033)
You need to log in before you can comment on or make changes to this bug.