-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 862ebe6
Showing
5 changed files
with
248 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/local/bin/perl | ||
# Copyright (c) 2010 ActiveState Software Inc. | ||
# See the file LICENSE.txt for licensing information. | ||
|
||
Import( | ||
'cons', | ||
'platform', | ||
'productType', | ||
'buildFlavour', | ||
'sdkDir', | ||
'idlExportDir', | ||
'build', | ||
'mozBin', | ||
'unsiloedPythonExe', | ||
'mozVersion', | ||
'mozExtensionDir', | ||
'mozIdlIncludePath', | ||
); | ||
|
||
$cons->KoExt("koinstall --packed"); | ||
|
||
# For quick development, comment out the "KoExt" call above and | ||
# use the following. The first time this is run, it will setup the | ||
# appropriate extension link. Then you need to *manually* do | ||
# a local "koext" dev build via: | ||
# python ../../sdk/bin/koext.py build --dev | ||
# You need to re-run "koext build --dev" every time you change or add | ||
# files that are built, e.g.: preprocessed files, idl files. However for | ||
# files that are not built -- e.g. XUL, CSS, JS, Python -- you don't | ||
# need to build at all, just re-start Komodo. | ||
# | ||
#$cons->KoExtSourceDevInstall(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components; | ||
Cu.import('resource://gre/modules/Services.jsm'); | ||
|
||
var startupData; | ||
|
||
function loadIntoWindow(window) { | ||
try { | ||
window.require.setRequirePath("focusmode/", "chrome://focusmode/content/"); | ||
window.require("focusmode").register(); | ||
} catch (e) { | ||
Cu.reportError("Exception while registering Focus Mode"); | ||
Cu.reportError(e); | ||
} | ||
} | ||
|
||
function unloadFromWindow(window) { | ||
} | ||
|
||
var windowListener = { | ||
onOpenWindow: function(aWindow) { | ||
// Wait for the window to finish loading | ||
let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow); | ||
domWindow.addEventListener("komodo-post-startup", function onLoad() { | ||
domWindow.removeEventListener("komodo-post-startup", onLoad, false); | ||
|
||
// Let dependencies load first | ||
var timers = domWindow.require("sdk/timers"); | ||
timers.setTimeout(function() { loadIntoWindow(domWindow); }, 0); | ||
}, false); | ||
}, | ||
|
||
onCloseWindow: function(aWindow) {}, | ||
onWindowTitleChange: function(aWindow, aTitle) {} | ||
}; | ||
|
||
function startup(data, reason) { | ||
startupData = data; | ||
|
||
// Load into any existing windows | ||
let windows = Services.wm.getEnumerator("Komodo"); | ||
while (windows.hasMoreElements()) { | ||
let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow); | ||
loadIntoWindow(domWindow); | ||
} | ||
|
||
// Load into any new windows | ||
Services.wm.addListener(windowListener); | ||
} | ||
|
||
function shutdown(data, reason) { | ||
// When the application is shutting down we normally don't have to clean | ||
// up any UI changes made | ||
if (reason == APP_SHUTDOWN) return; | ||
|
||
// Stop listening for new windows | ||
Services.wm.removeListener(windowListener); | ||
|
||
// Unload from any existing windows | ||
let windows = Services.wm.getEnumerator("Komodo"); | ||
while (windows.hasMoreElements()) { | ||
let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow); | ||
unloadFromWindow(domWindow); | ||
} | ||
} | ||
|
||
function install(data, reason) {} | ||
|
||
function uninstall(data, reason) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
content focusmode content/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
(function() { | ||
const log = require("ko/logging").getLogger("focusmode"); | ||
const {Cc, Ci} = require("chrome"); | ||
const prefs = require("ko/prefs"); | ||
const commands = require("ko/commands"); | ||
const menu = require("ko/menu"); | ||
|
||
var elems = { | ||
toolbars: document.getElementById("main-toolboxrow-wrapper"), | ||
toolbarsBc: document.getElementById("cmd_toggleToolbars"), | ||
menu: document.getElementById("toolbar-menubar"), | ||
menuBc: document.getElementById("cmd_toggleMenubar") | ||
} | ||
|
||
var active = prefs.getBoolean("focusmode_on", false); | ||
var state = JSON.parse(prefs.getString("focusmode_state", "{}")); | ||
|
||
log.setLevel(require("ko/logging").LOG_DEBUG); | ||
|
||
this.register = function() | ||
{ | ||
commands.register("focusmode", this.toggle.bind(this), { | ||
label: "Toggle Focus Mode" | ||
}); | ||
|
||
menu.register("Toggle Focus Mode", this.toggle.bind(this), { | ||
command: "ko.commands.doCommandAsync('cmd_focusmode')", | ||
context: [ | ||
{ | ||
select: "#popup_view", | ||
before: "#menu_view_tabs" | ||
} | ||
] | ||
}); | ||
} | ||
|
||
this.toggle = function() | ||
{ | ||
if (active) | ||
this.disable(); | ||
else | ||
this.enable(); | ||
} | ||
|
||
this.enable = function() | ||
{ | ||
log.debug("Enabling Focus Mode"); | ||
|
||
this.saveState(); | ||
|
||
active = true; | ||
prefs.setBoolean("focusmode_on", true); | ||
|
||
if (state.toolbars) ko.commands.doCommand('cmd_toggleToolbars'); | ||
if (state.menu) ko.commands.doCommand('cmd_toggleMenubar'); | ||
ko.uilayout.ensurePaneHidden("workspace_left_area"); | ||
ko.uilayout.ensurePaneHidden("workspace_right_area"); | ||
ko.uilayout.ensurePaneHidden("workspace_bottom_area"); | ||
|
||
elems.toolbarsBc.setAttribute("checked", "false"); | ||
elems.menuBc.setAttribute("checked", "false"); | ||
} | ||
|
||
this.disable = function() | ||
{ | ||
log.debug("Disabling Focus Mode"); | ||
|
||
active = false; | ||
prefs.setBoolean("focusmode_on", false); | ||
|
||
var _state = this.getState(); | ||
if (state.toolbars && state.toolbars != _state.toolbars) | ||
{ | ||
ko.commands.doCommand('cmd_toggleToolbars'); | ||
elems.toolbarsBc.setAttribute("checked", "true"); | ||
} | ||
|
||
if (state.menu && state.menu != _state.menu) | ||
{ | ||
ko.commands.doCommand('cmd_toggleMenubar'); | ||
elems.menuBc.setAttribute("checked", "true"); | ||
} | ||
|
||
if (state.leftPane) ko.uilayout.ensurePaneShown("workspace_left_area"); | ||
if (state.rightPane) ko.uilayout.ensurePaneShown("workspace_right_area"); | ||
if (state.bottomPane) ko.uilayout.ensurePaneShown("workspace_bottom_area"); | ||
} | ||
|
||
this.getState = function() | ||
{ | ||
var _state = {}; | ||
|
||
_state.toolbars = elems.toolbars.getAttribute("collapsed") != "true"; | ||
_state.menu = elems.menu.getAttribute("inactive") != "true"; | ||
|
||
_state["leftPane"] = ko.uilayout.leftPaneShown(); | ||
_state["rightPane"] = ko.uilayout.rightPaneShown(); | ||
_state["bottomPane"] = ko.uilayout.outputPaneShown(); | ||
|
||
return _state; | ||
} | ||
|
||
this.saveState = function(_state) | ||
{ | ||
if ( ! _state) _state = this.getState(); | ||
|
||
_stateJson = JSON.stringify(_state); | ||
log.debug("Saving state: " + _stateJson); | ||
|
||
prefs.setString("focusmode_state", _stateJson); | ||
state = _state; | ||
} | ||
|
||
}).apply(module.exports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0"?> | ||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:em="http://www.mozilla.org/2004/em-rdf#"> | ||
<Description about="urn:mozilla:install-manifest"> | ||
<em:id>[email protected]</em:id> | ||
<em:name>Focus Mode</em:name> | ||
<em:version>1.0</em:version> | ||
<em:description>Adds a toggle that enables/disables all non-essential UI elements</em:description> | ||
<em:creator>Nathan Rijksen</em:creator> | ||
<em:homepageURL>http://www.activestate.com/komodo-ide</em:homepageURL> | ||
<em:iconURL>chrome://scope-shell-gem/skin/icon.png</em:iconURL> | ||
<em:type>2</em:type> <!-- type=extension --> | ||
<em:bootstrap>true</em:bootstrap> <!-- Restartless Addon --> | ||
<em:unpack>true</em:unpack> | ||
|
||
<em:targetApplication> | ||
<Description> | ||
<!-- Komodo IDE's uuid --> | ||
<em:id>{36E66FA0-F259-11D9-850E-000D935D3368}</em:id> | ||
<em:minVersion>8.*</em:minVersion> <!-- Workaround for alphanumeric versions - NOT tested on 8.* --> | ||
<em:maxVersion>9.1</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
<em:targetApplication> | ||
<Description> | ||
<!-- Komodo Edit's uuid --> | ||
<em:id>{b1042fb5-9e9c-11db-b107-000d935d3368}</em:id> | ||
<em:minVersion>8.*</em:minVersion> <!-- Workaround for alphanumeric versions - NOT tested on 8.* --> | ||
<em:maxVersion>9.1</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
</Description> | ||
</RDF> |