diff --git a/common/content/commandline.js b/common/content/commandline.js index 98b62274..18891285 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -149,8 +149,10 @@ const CommandWidgets = Class("CommandWidgets", { multilineOutput: Class.memoize(function () { let elem = document.getElementById("dactyl-multiline-output"); elem.contentDocument.body.id = "dactyl-multiline-output-content"; - document.getElementById("dactyl-context-copylink").style.listStyleImage = - util.computedStyle(document.getElementById("context-copylink")).listStyleImage; + ["copy", "copylink", "selectall"].forEach(function (id) { + document.getElementById("dactyl-context-" + id).style.listStyleImage = + util.computedStyle(document.getElementById("context-" + id)).listStyleImage; + }); return elem; }), multilineInput: Class.memoize(function () document.getElementById("dactyl-multiline-input")), @@ -748,6 +750,19 @@ const CommandLine = Module("commandline", { this.timeout(function () { this.widgets.multilineInput.focus(); }, 10); }, + onContext: function onContext(event) { + let enabled = { + link: window.document.popupNode instanceof HTMLAnchorElement, + selection: !window.document.commandDispatcher.focusedWindow.getSelection().isCollapsed + }; + + for (let [, node] in iter(event.target.childNodes)) { + let group = node.getAttributeNS(NS, "group"); + node.hidden = group && !groups.split(/\s+/).some(function (g) enabled[g]); + } + return true; + }, + /** * Handles all command-line events. All key events are passed here when * COMMAND_LINE mode is active, as well as all input, keyup, focus, and diff --git a/common/content/dactyl.xul b/common/content/dactyl.xul index 9ef44375..e52ce6ff 100644 --- a/common/content/dactyl.xul +++ b/common/content/dactyl.xul @@ -37,10 +37,16 @@ noautohide="true" noautofocus="true"/> + onpopupshowing="return (event.target != this || dactyl.modules.commandline.onContext(event));"> + +