Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Close window hides to tray option, can not close individual windows #24

Closed
hanspr opened this issue Mar 25, 2012 · 5 comments
Closed

Close window hides to tray option, can not close individual windows #24

hanspr opened this issue Mar 25, 2012 · 5 comments
Labels

Comments

@hanspr
Copy link

hanspr commented Mar 25, 2012

To reproduce problem :
Open Firefox (with firetray extension enabled)
Firefox menu > Open New Window (do it 3 times)
Now you have 4 windows
Close individually all of them
Right clic on Tray Icon. I shows 4 Firefox icons
Click icon to restore, opens the 4 windows
There is no way to close the extra 3 windows any more.

System information
Firetray 0.4.1
Firefox 11
Ubuntu 11.04

If you have the "close window hides to tray" option set. You can no longer close individual windows, actually terminate them.

Some applications open new windows from links, to show some detailed information, PDF view, etc.
Some times you open a new window by mistake or on purpose.

When you close this additional or "pop up" windows, all get hidden instead of being actually closed (or terminated).

So after clicking 20 links you have 20 hidden windows in the tray.

There needs to be a way to distinguish between closing the main window or the "children ones", or an option to that states :

"Only main window hides to tray". Being the main window the one that was open first of all, others, the one that opened at start up. I know that there is no actual main window in a Browser, but the concept of using the very first one opened at start up, as the main window, is something that intuitively we use. It would be like the concept of the tabs. You can close them individually, but when you arrive to the last one that one you can no longer close, that would be like your main tab.

A second similar logic is, if there is more than 1 existing window, it closes. If this is the last (or only window) then it hides to tray.
The option would be : "hide to tray only last window on close". Or "Close all windows on close, hide to tray when only 1".

I have never programmed an extension, browsed the code but could not find function that handles the close action.
If you could point me to the proper function, I think I could implement the second logic, is fairly straight forward. And have done it with other extensions, add a few lines.

Good luck.

@hanspr
Copy link
Author

hanspr commented Mar 26, 2012

Fixed,

Edit : overlay.js

If hide_on_close is set will check for the number of windows opened.
If more than one, ignores de hide_on_close, will actually close the window.
If is the last opened windows, will hide it.

if (hides_on_close) {
if (firetray.Handler.windowsCount == 1) {
if (hides_single_window) {
let winId = firetray.Handler.getWindowIdFromChromeWindow(win);
firetray.Handler.hideSingleWindow(winId);
} else
firetray.Handler.hideAllWindows();
event && event.preventDefault();
}
}

This works fine for me, but other people might not like it, that is why I believe that there should be an option for this behavior.

Good luck

@hanspr hanspr closed this as completed Mar 26, 2012
@foudfou
Copy link
Owner

foudfou commented Mar 28, 2012

Hi, a few suggestions:

  • you can close individual windows using the keyboard (Ctrl-w), although this might not be very handy if you use the mouse a lot
  • you could use the minimize button for actually hiding to tray, and keep the close button for closing windows (unset Closing window hides to tray, set "Minimizing window hides to tray*)

Regarding your request for a new hides_on_close_last_only preference, I'd prefer to wait for similar requests/complaints before actually implementing it.

@tomjenkinson
Copy link

I would like to request the capability described in the bug report, I like to use Alt-F4 to close the window until I hit the last window which I like to minimize, a bit like firetray for thunderbird

@foudfou foudfou reopened this Sep 10, 2012
foudfou pushed a commit that referenced this issue Sep 10, 2012
@foudfou
Copy link
Owner

foudfou commented Sep 10, 2012

Here your are :-) 90ee9f8 You can build it yourself or it will be included in the next soon coming version.

@foudfou foudfou closed this as completed Sep 10, 2012
@tomjenkinson
Copy link

Thanks! Great stuff :)

On 2012-09-10T14:06:42 BST, foudfou wrote:

Here your are :-) 90ee9f8
90ee9f834b44 You can
build it yourself https://github.com/foudfou/FireTray/wiki/Build or
it will be included in the next soon coming version.


Reply to this email directly or view it on GitHub
#24 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants