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")
|
||||
|
||||
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
|
||||
|
||||
* 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();
|
||||
|
||||
// prevent window closing.
|
||||
if (mozt.Utils.prefService.getBoolPref('close_hides')) {
|
||||
mozt.Debug.debug('close_hides set');
|
||||
let that = this;
|
||||
window.addEventListener('close', that.onClose, true);
|
||||
}
|
||||
let that = this;
|
||||
window.addEventListener('close', that.onClose, true);
|
||||
// NOTE: each new window gets a new mozt.Main, and hence listens to pref
|
||||
// changes
|
||||
|
||||
mozt.Debug.debug('Moztray LOADED: ' + init);
|
||||
return true;
|
||||
@ -53,32 +52,22 @@ mozt.Main = {
|
||||
},
|
||||
|
||||
// TODO: prevent preceding warning about closing multiple tabs
|
||||
// (browser.tabs.warnOnClose)
|
||||
onClose: function(event) {
|
||||
mozt.Debug.debug('Moztray CLOSE');
|
||||
mozt.Handler.showHideToTray();
|
||||
event.preventDefault();
|
||||
let close_hides = mozt.Utils.prefService.getBoolPref('close_hides');
|
||||
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) {
|
||||
// Observer for pref changes
|
||||
if (topic != "nsPref:changed") return;
|
||||
mozt.Debug.debug('Pref changed: '+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;
|
||||
}
|
||||
// switch(data) { ...
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -8,4 +8,10 @@
|
||||
<stringbundle id="moztray-strings" src="chrome://moztray/locale/overlay.properties"/>
|
||||
</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>
|
||||
|
@ -3,3 +3,6 @@ pref("extensions.moztray@foudil.fr.description", "chrome://moztray/locale/overla
|
||||
|
||||
// Extension prefs
|
||||
pref("extensions.moztray.close_hides", true);
|
||||
|
||||
// Global prefs
|
||||
pref("browser.tabs.warnOnClose", false);
|
||||
|
@ -19,7 +19,7 @@
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
|
||||
<em:minVersion>4.0</em:minVersion>
|
||||
<em:maxVersion>6.*</em:maxVersion>
|
||||
<em:maxVersion>8.*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
<Description>
|
||||
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
|
||||
<em:minVersion>3.0</em:minVersion>
|
||||
<em:maxVersion>5.*</em:maxVersion>
|
||||
<em:maxVersion>8.*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
|
@ -151,7 +151,7 @@ mozt.Handler = {
|
||||
mozt.Debug.debug("OS=" + runtimeOS + ", XULrunner=" + xulVer);
|
||||
if (runtimeOS != "Linux") {
|
||||
Components.utils.reportError("MOZTRAY: only Linux platform supported at this time. Moztray not loaded");
|
||||
return;
|
||||
return false;
|
||||
// Cu.import("resource://moztray/MoztHandler-Linux.jsm");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user