Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams mrchrisadams/1014090.patch Secret
Last active May 22, 2018

Embed
What would you like to do?
It wasn't obvious how to attach this patch in bugzilla, or on the command line, so I'm using this secret gist for now.
# HG changeset patch
# User Chris Adams <chris@productscience.co.uk>
# Date 1526983200 -7200
# Tue May 22 12:00:00 2018 +0200
# Node ID 478f9211661aaefef2ff2a8d56b91f1163db0f8b
# Parent dc1868d255be744a7d2d462216be205086cc60af
Bug 1014090 - Toggle inspector on mac with extra cmd+shift+C shortcut
diff --git a/devtools/client/definitions.js b/devtools/client/definitions.js
--- a/devtools/client/definitions.js
+++ b/devtools/client/definitions.js
@@ -73,9 +73,15 @@ Tools.inspector = {
label: l10n("inspector.label"),
panelLabel: l10n("inspector.panelLabel"),
get tooltip() {
- return l10n("inspector.tooltip2",
- (osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") +
- l10n("inspector.commandkey"));
+ if (osString == "Darwin") {
+ let ctrlShiftC = "Ctrl+Shift+" + l10n("inspector.commandkey");
+ let cmdOptC = "Cmd+Opt+" + l10n("inspector.commandkey");
+ return l10n("inspector.mac.tooltip", ctrlShiftC, cmdOptC);
+ } else {
+ return l10n("inspector.tooltip2", "Ctrl+Shift+") + l10n("inspector.commandkey");
+ }
+
+
},
inMenu: true,
commands: [
@@ -624,9 +630,9 @@ exports.ToolboxButtons = [
* Optional format argument.
* @returns A localized version of the given key.
*/
-function l10n(name, arg) {
+function l10n(name, ...args) {
try {
- return arg ? L10N.getFormatStr(name, arg) : L10N.getStr(name);
+ return args ? L10N.getFormatStr(name, ...args) : L10N.getStr(name);
} catch (ex) {
console.log("Error reading '" + name + "'");
throw new Error("l10n error with " + name);
diff --git a/devtools/client/locales/en-US/startup.properties b/devtools/client/locales/en-US/startup.properties
--- a/devtools/client/locales/en-US/startup.properties
+++ b/devtools/client/locales/en-US/startup.properties
@@ -154,6 +154,10 @@ inspector.panelLabel=Inspector Panel
# Keyboard shortcut for DOM and Style Inspector will be shown inside brackets.
inspector.tooltip2=DOM and Style Inspector (%S)
+# LOCALIZATION NOTE (inspector.tooltip2)
+# On a mac only, we support toggling the inspector with either cmd+shift+C or cmd+opt+C
+inspector.mac.tooltip=DOM and Style Inspector (%1$S or %2$S)
+
# LOCALIZATION NOTE (netmonitor.label):
# This string is displayed in the title of the tab when the Network Monitor is
# displayed inside the developer tools window and in the Developer Tools Menu.
diff --git a/devtools/startup/devtools-startup.js b/devtools/startup/devtools-startup.js
--- a/devtools/startup/devtools-startup.js
+++ b/devtools/startup/devtools-startup.js
@@ -69,7 +69,7 @@ XPCOMUtils.defineLazyGetter(this, "KeySh
// List of all key shortcuts triggering installation UI
// `id` should match tool's id from client/definitions.js
- return [
+ let shortCuts = [
// The following keys are also registered in /client/menus.js
// And should be synced.
@@ -169,6 +169,17 @@ XPCOMUtils.defineLazyGetter(this, "KeySh
modifiers
},
];
+
+ if (isMac) {
+ // add the extra key command, so you can open the inspector with cmd+shift+C, like chrome
+ shortCuts.push({
+ toolId: "inspector",
+ shortcut: KeyShortcutsBundle.GetStringFromName("inspector.commandkey"),
+ modifiers: "accel,shift"
+ });
+ }
+ return shortCuts;
+
});
function DevToolsStartup() {

Ok,

I've tried both ways to attach a patch as listed below:

https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch#Submitting_the_patch

Submitting through bugzilla

It might be staring me in the face, but I couldn't see any text, link or button along the lines of 'add an attachment' as outlined in the docs.

Submitting through mercurial

Here's the output from when I tried to set up mercurial to attach patches from the command line:"

~/C/m/mozilla-central ❯❯❯ ./mach mercurial-setup                                                                                     ⏎
================================================================================
Ensuring https://hg.mozilla.org/hgcustom/version-control-tools is up to date at /Users/chrisadams/.mozbuild/version-control-tools
pulling from https://hg.mozilla.org/hgcustom/version-control-tools
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 3 changes to 3 files
updating bookmark @
new changesets 64e8a28c6208
(run 'hg update' to get a working copy)
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
================================================================================
This wizard will guide you through configuring Mercurial for an optimal
experience contributing to Mozilla projects.

The wizard makes no changes without your permission.

To begin, press the enter/return key.


It looks like the setup wizard has already installed a copy of the
evolve extension on your machine, at /Users/chrisadams/.mozbuild/evolve.

(Relevant config option: extensions.evolve)

Would you like to update evolve to the latest version?  (Yn)
pulling from https://www.mercurial-scm.org/repo/evolve/
no changes found
16010 new obsolescence markers
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
Evolve was updated successfully.

Okay, this looks promising. Let's see what happens when we try running that bzexport command:

~/C/m/mozilla-central ❯❯❯ hg bzexport -e
hg: unknown command 'bzexport'
(did you mean export?)

Oh. What did I do wrong here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.