From 435e0ea73bd40a3f3cd2a18d9fdcff050d9acb9f Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Wed, 15 Jul 2015 10:51:31 -0400 Subject: [PATCH] Fixed issues with running focusmode on OSX --- content/focusmode.js | 14 +++++++++++--- install.rdf | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/content/focusmode.js b/content/focusmode.js index 86d9e6b..342974d 100644 --- a/content/focusmode.js +++ b/content/focusmode.js @@ -14,7 +14,9 @@ var active = prefs.getBoolean("focusmode_on", false); var state = JSON.parse(prefs.getString("focusmode_state", "{}")); - + var platform = require("sdk/system").platform; + var isOSX = platform == "darwin"; + //log.setLevel(require("ko/logging").LOG_DEBUG); this.register = function() @@ -32,6 +34,12 @@ } ] }); + + // Work around bug in Komodo <9.2 + if ( ! "updateToolboxVisibility" in ko.uilayout) + { + ko.uilayout.updateToolboxVisibility = function() {}; + } } this.toggle = function() @@ -52,7 +60,7 @@ prefs.setBoolean("focusmode_on", true); if (state.toolbars) ko.commands.doCommand('cmd_toggleToolbars'); - if (state.menu) ko.commands.doCommand('cmd_toggleMenubar'); + if (state.menu && ! isOSX) ko.commands.doCommand('cmd_toggleMenubar'); ko.uilayout.ensurePaneHidden("workspace_left_area"); ko.uilayout.ensurePaneHidden("workspace_right_area"); ko.uilayout.ensurePaneHidden("workspace_bottom_area"); @@ -75,7 +83,7 @@ elems.toolbarsBc.setAttribute("checked", "true"); } - if (state.menu && state.menu != _state.menu) + if ( ! isOSX && state.menu && state.menu != _state.menu) { ko.commands.doCommand('cmd_toggleMenubar'); elems.menuBc.setAttribute("checked", "true"); diff --git a/install.rdf b/install.rdf index 457fa92..8dea5ce 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ focusmode@activestate.com Focus Mode - 1.0.1 + 1.0.2 Adds a toggle that enables/disables all non-essential UI elements Nathan Rijksen http://www.activestate.com/komodo-ide