Support § as shortcut key

Hi There,

I recently discovered that controlling zoom levels with ctrl-1 (zoom reset), ctrl-2 (zoom in) and ctrl-§ (zoom out) is nicer on my keyboard - intl. english mac where the § key is next to the 1 key.

Why is this nicer? Because I can zoom using one hand instead of two - ctrl-0 meant left hand holds ctrl (yes I could do this with right thumb but ...) and the right hand presses 0 - so zoom - for me - was always a two handed activity.

I don't wish to start a debate about where or where not the zoom should be - the nice thing is that I can change it to how I like it and that's what I did except ...

The § key does not work in combination with ctrl, i.e., somehow it cannot be part of a shortcut, so shortcutting ctrl-§ to zoom out didn't work ... but my OCD jumped out of the box and won't leave me allow until I found this --> node-red/packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js at 7700aa9121c26a7ef39973c8ec5b097b96abc7e3 · node-red/node-red · GitHub --> a keymap mapping which maps "special" characters to their key code. If I add § with a keycode of 192 (as it is mapped on my setup), the shortcut worked.

So my question is: is § mapping to 192 universal? and secondly, should the character be added to the list of keymappings - what are the consequences of doing that? Because I have no answer to both those questions, I haven't created a PR.

P.S. having described this, I might actually go back to using the right hand version of ctrl-{0, -, +} since .... it's the default and my preference is to actually use the default settings on tools. Why? Because it's less configuration fiddling when reinstalling or upgrading.

P.P.S although mapping zoom to ctrl-{§,1,2} does have the advantage that the browser builtin zoom stays intact. Which it does sometimes in Node-RED -- i.e. I sometimes get browser zooming if I'm not in the workspace because the default shortcut ctrl-{0,-,+} is only defined in the workspace, so there is a mixing of browser zooming and NR zooming when the shortcut 0,-,+ is used.

Whilst I cannot comment on whether that is a universal mapping (but it would be good to find out), I will say that for the lat 10 years or so, I've had Cmd-§ configured on my Mac as a global shortcut to open a new terminal. Then I got a new Mac running latest MacOS and it refuses to let you use § as a shortcut key. A 10-year habit broken by an OS upgrade.

I only mention it because it could hint at some funky virtual key mapping thing that does make it an odd one to handle in a proper cross-browser/OS/keyboard layout way.... but we can try.

Does that mean you're right handed btw? I assume you use Cmd-§ for the same reason: it's one hand instead of two if Cmd on the left is used.

I haven't configured Cmd-§ to do anything special except in NR in Firefox - haven't tested Safari yet. I did try it on my old mac (intel box) with an old Firefox and there the shortcut didn't work - I didn't investigate any further.

But I do think that the P.P.S above should be discussed: moving zoom to something else because I often fall into the trap that zoom, Cmd-{0,+,-} zooms the browser when I meant the workspace but because my mouse was else where in the NR, browser zoom was activated.

But to contradict myself, of course, the zoom setting has been around for ten years and if no one has noticed this, then it's one of my own things.

I forgot to say how I got the keyCode: in the browser console for NodeRED:

$(document).on('keydown', (e) => console.log(`${e.originalEvent.key} --> ${e.originalEvent.code} --> ${e.originalEvent.keyCode}`))

interestingly it got called backquote ...

§ --> Backquote --> 192

Mac 15.6 / Firefox 145.0

I do rather suspect that this may be the answer to whether this is "universal". Since I don't remember ever seeing the § character on any keyboard - well, any 99.999% standard keyboard as used by IBM and Microsoft for over 40 years!

Actually, I tell a lie. I think it WAS on the special IBM APL keyboards as APL uses all manner of funky math symbols. :rofl:

I've not looked on my UK layout Macbook Pro - but I did once have quite the argument with our Apple account manager and her tech pre-sales flunky about non-standard Apple UK keyboard layouts! Their response being effectively: "We're Apple, we are better than everyone else in the universe so of course we will force people to unlearn their 40+ years of muscle memory"! (well, I may have had to paraphrase slightly there).

To be fair, I chose the keyboard extra to be an english international and hence backquote (which “normally” lives up there) has moved and I got this “section” key.

As you say, it’s rarely used and i could have the banana key up there for all i care. For this feature - much like real estate - it’s all about location. The consecutive three keys in the corner is what counts.

I don’t know who’s doing the forcing on keyboard layouts, qwerty(z) is standard and that makes 90% of the muscle. There is nothing in nature that forces us to have this layout. For me, apple is being consistent with its layouts rather than forcing it upon me - i could also have had us, uk or au English layouts. Apple gives me a choice when purchasing their hardware.

Sorry, I was just airing a grievance that Apple's UK keyboard layout, on the Macbook Pro I have is most certainly not quite standard. Given that the @ and " keys are swapped which is closer to the US than the standard UK layout. Oh, and, having dug out said Macbook, I can see that I do indeed have the § character at the top-left - never even noticed it! It has the +- key as its shifted version. I don't believe I've ever used either character in over 40 years of computer use. :smiley:

tisk tisk, it's not +- but ± :slight_smile: A wonderful key. I thought about exactly the same things last night - when have I ever used ± or §? But I'm neither a lawyer nor physicist.

§ that looks a bit like a moustache only vertical so I can guess creating the vertical-moustache software package would be a good idea - now that I've found this key. I guess it would do the same as as mustache[1] only that instead of { }, you'd use § and the amazing thing about the vertical-mustache project is that it knows which one is closing and which is the §opening moustache§. No more shifting the square bracket key to get the curly ones! What a win! Plus it would also be able to handle nesting §§§ §§ fubar §§ §§§ isn't a problem, just an eyesore.

Sorry where was I going with this?

Totally agree, both are under utilised keys so there should be an official § and ± days - 21.November each year folks should be using the § ± - the "Under Utilised Keyboard Key Day" (UUKKD) :slight_smile: T-shirts could be printed, towels made ... and the world would be a better place!

[1] = vertical-moustache - British English please!

P.S. it's Friday where I am.

P.P.S. I find the idea of celebrating under utilised keyboard keys a strangely good idea :thinking:

I knew that, but my keyboards (other than the Mac that I'm not firing up just for this) do not have that key and I couldn't be bothered to go and find its HTML equivalent on the interweb!

:smiley:

Only under utilised on Apple Mac's - they are irrelevant to 99.99999999999999% (rough estimate) of all of the humans who have ever or will ever inhabit the Earth (or anywhere else for that matter)! :rofl:

Or just strange? :weary_cat:

1 Like

At the risk of getting meta: I know you knew and I knew it that you know when I wrote it! Was being pedantically funny - use pedanticism as an instrument of humour!

Hence my point on lawyers or physicists - I'm sure they have users. And I'm not counting, but I have the feeling that there are more of them then us :eye:

Also if Apple has made the decision to add those two characters - where there are a million and one other characters (think emoticons here) - there must be a reason. Perhaps its saves ink because all the other possible characters use more ink or because there is a subset of folks who actually use these characters - I'm going for the latter.

I recently discovered CGP Grey (you tube channel - search for pirates or flags), I think this would be a good question for him: why is there a ^ above the 6 and why isn't somewhere else - for example? These characters are just as random, only that programmers have made use of them for other things. The Carat was never intended as the to-the-power-of function but it became that. And so it is with the § symbol - it will also find it's use case - one day. (similar to the * multiple which actually should be 'x' but that doesn't working in programming lanugages.)

But my favourite, is of course, !important meaning very important in CSS and not important everywhere else. Or simply exclamation it's IMPORTANT. Why ! should be not is also a question for the past.

People are strange when you come out of the rain.