mirror of
https://github.com/moparisthebest/FireTray
synced 2024-12-22 05:48:49 -05:00
* refactor handeling of 'close_hides': eventListeners("close") never removed
from windows. Pros: reads much simpler. Cons: unnecessary eventListeners (but not harmful either). * experimental kb shortcut for hiding all windows (whatever the value of 'close_hises') * bumped to version 8.* (FF, TB)
This commit is contained in:
parent
18e555d10d
commit
f5b279298e
27
README.md
27
README.md
@ -1,5 +1,28 @@
|
|||||||
rewrite of **Firetray** with js-ctypes
|
Moztray
|
||||||
|
=======
|
||||||
|
|
||||||
## KNOWN BUGS ##
|
Overview
|
||||||
|
--------
|
||||||
|
|
||||||
|
Rewrite attempt of **Firetray** with js-ctypes, with focus on message count display.
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
* Moztray unsets the `tabs.warnOnClose` built-in preference, which otherwise disrupts the handeling of the close event.
|
||||||
|
* Experimental non-customizable keyboard shortcut for hiding all windows set to: `accel-shift-w`
|
||||||
|
|
||||||
|
* if you're looking for other mozilla-desktop integration:
|
||||||
|
* Paul Neulinger's [Gnome-shell-Thunderbird integration](https://github.com/tanwald/gnome-shell-extension-thunderbird-integration "gnome-shell-thunderbird integration")
|
||||||
|
* Mike Conley's [Unity-Thunderbird integration](http://mozillalabs.com/messaging/messaging-menu/ "Unity-Thunderbird integration")
|
||||||
|
|
||||||
|
KNOWN BUGS
|
||||||
|
----------
|
||||||
|
|
||||||
* windows aren't restored with the same z-order, but there is [no means to correct that under Linux](https://bugzilla.mozilla.org/show_bug.cgi?id=156333 "GetZOrderDOMWindowEnumerator is broken on Linux")
|
* windows aren't restored with the same z-order, but there is [no means to correct that under Linux](https://bugzilla.mozilla.org/show_bug.cgi?id=156333 "GetZOrderDOMWindowEnumerator is broken on Linux")
|
||||||
|
|
||||||
|
Acknowledgment
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* Some code borrowed from [Mike Conley](http://mzl.la/messagingmenu "Thanks Mike").
|
||||||
|
* kind support from Neil Deaking
|
||||||
|
2
TODO
2
TODO
@ -1,5 +1,3 @@
|
|||||||
* fix 'close_hides' option behavior
|
|
||||||
|
|
||||||
* add 'quit' to icon menu + add option UI for close_all_tabs
|
* add 'quit' to icon menu + add option UI for close_all_tabs
|
||||||
|
|
||||||
* make multi-platform. At least have js-ctypes library call dependant on OS detection. (best would be to have the OS-dependant modules loaded at startup)
|
* make multi-platform. At least have js-ctypes library call dependant on OS detection. (best would be to have the OS-dependant modules loaded at startup)
|
||||||
|
@ -30,11 +30,10 @@ mozt.Main = {
|
|||||||
let init = mozt.Handler.initialized || mozt.Handler.init();
|
let init = mozt.Handler.initialized || mozt.Handler.init();
|
||||||
|
|
||||||
// prevent window closing.
|
// prevent window closing.
|
||||||
if (mozt.Utils.prefService.getBoolPref('close_hides')) {
|
let that = this;
|
||||||
mozt.Debug.debug('close_hides set');
|
window.addEventListener('close', that.onClose, true);
|
||||||
let that = this;
|
// NOTE: each new window gets a new mozt.Main, and hence listens to pref
|
||||||
window.addEventListener('close', that.onClose, true);
|
// changes
|
||||||
}
|
|
||||||
|
|
||||||
mozt.Debug.debug('Moztray LOADED: ' + init);
|
mozt.Debug.debug('Moztray LOADED: ' + init);
|
||||||
return true;
|
return true;
|
||||||
@ -53,32 +52,22 @@ mozt.Main = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// TODO: prevent preceding warning about closing multiple tabs
|
// TODO: prevent preceding warning about closing multiple tabs
|
||||||
|
// (browser.tabs.warnOnClose)
|
||||||
onClose: function(event) {
|
onClose: function(event) {
|
||||||
mozt.Debug.debug('Moztray CLOSE');
|
mozt.Debug.debug('Moztray CLOSE');
|
||||||
mozt.Handler.showHideToTray();
|
let close_hides = mozt.Utils.prefService.getBoolPref('close_hides');
|
||||||
event.preventDefault();
|
mozt.Debug.debug('close_hides: '+close_hides);
|
||||||
|
if (close_hides) {
|
||||||
|
mozt.Handler.showHideToTray();
|
||||||
|
event && event.preventDefault(); // no event when called directly (xul)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// NOTE: each new window gets a new mozt.Main, and hence listens to pref
|
|
||||||
// changes
|
|
||||||
observe: function(subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
// Observer for pref changes
|
// Observer for pref changes
|
||||||
if (topic != "nsPref:changed") return;
|
if (topic != "nsPref:changed") return;
|
||||||
mozt.Debug.debug('Pref changed: '+data);
|
mozt.Debug.debug('Pref changed: '+data);
|
||||||
|
// switch(data) { ...
|
||||||
switch(data) {
|
|
||||||
case 'close_hides': // prevent window closing.
|
|
||||||
let close_hides = mozt.Utils.prefService.getBoolPref('close_hides');
|
|
||||||
let that = this;
|
|
||||||
if (close_hides) {
|
|
||||||
mozt.Debug.debug('close_hides: '+close_hides);
|
|
||||||
window.addEventListener('close', that.onClose, true); // mozt.Main.onClose;
|
|
||||||
} else {
|
|
||||||
mozt.Debug.debug('close_hides: '+close_hides);
|
|
||||||
window.removeEventListener('close', that.onClose, true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -8,4 +8,10 @@
|
|||||||
<stringbundle id="moztray-strings" src="chrome://moztray/locale/overlay.properties"/>
|
<stringbundle id="moztray-strings" src="chrome://moztray/locale/overlay.properties"/>
|
||||||
</stringbundleset>
|
</stringbundleset>
|
||||||
|
|
||||||
|
<keyset>
|
||||||
|
<!-- otherwide window.addEventListener("keypress", mozt.Main.onKeyPress, true);
|
||||||
|
see https://addons.mozilla.org/en-US/firefox/addon/move-tabs/ -->
|
||||||
|
<key id="key_close" key="W" modifiers="shift meta" oncommand="mozt.Handler.showHideToTray();" /> <!-- mozt.Main.onKeyClose(); -->
|
||||||
|
</keyset>
|
||||||
|
|
||||||
</overlay>
|
</overlay>
|
||||||
|
@ -3,3 +3,6 @@ pref("extensions.moztray@foudil.fr.description", "chrome://moztray/locale/overla
|
|||||||
|
|
||||||
// Extension prefs
|
// Extension prefs
|
||||||
pref("extensions.moztray.close_hides", true);
|
pref("extensions.moztray.close_hides", true);
|
||||||
|
|
||||||
|
// Global prefs
|
||||||
|
pref("browser.tabs.warnOnClose", false);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<Description>
|
<Description>
|
||||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
|
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
|
||||||
<em:minVersion>4.0</em:minVersion>
|
<em:minVersion>4.0</em:minVersion>
|
||||||
<em:maxVersion>6.*</em:maxVersion>
|
<em:maxVersion>8.*</em:maxVersion>
|
||||||
</Description>
|
</Description>
|
||||||
</em:targetApplication>
|
</em:targetApplication>
|
||||||
|
|
||||||
@ -27,7 +27,7 @@
|
|||||||
<Description>
|
<Description>
|
||||||
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
|
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
|
||||||
<em:minVersion>3.0</em:minVersion>
|
<em:minVersion>3.0</em:minVersion>
|
||||||
<em:maxVersion>5.*</em:maxVersion>
|
<em:maxVersion>8.*</em:maxVersion>
|
||||||
</Description>
|
</Description>
|
||||||
</em:targetApplication>
|
</em:targetApplication>
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ mozt.Handler = {
|
|||||||
mozt.Debug.debug("OS=" + runtimeOS + ", XULrunner=" + xulVer);
|
mozt.Debug.debug("OS=" + runtimeOS + ", XULrunner=" + xulVer);
|
||||||
if (runtimeOS != "Linux") {
|
if (runtimeOS != "Linux") {
|
||||||
Components.utils.reportError("MOZTRAY: only Linux platform supported at this time. Moztray not loaded");
|
Components.utils.reportError("MOZTRAY: only Linux platform supported at this time. Moztray not loaded");
|
||||||
return;
|
return false;
|
||||||
// Cu.import("resource://moztray/MoztHandler-Linux.jsm");
|
// Cu.import("resource://moztray/MoztHandler-Linux.jsm");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user