textual
textual copied to clipboard
Swiss keyboard is inconvenient to access the palette command.
Hi.
I have a french keyboard mapped to a swiss french keyboard. I'll keep it this way, because the swiss keyboard is one of the best in the world: access to all the weird characters for french, italian, and german.
It thus is inconvenient when it comes to accessing the keyboard palette. I need to type AltGr + Shift + Ctrl + [7|è]. Four fingers immobilised accross the whole keyboard. It feels even more inconvienent than hooking a piano pedal into emacs to have extra special keys accessible with one's feet...
I may be old school, but I do find the modal ideology of keybindings to be fairly effective. An Esc + ':' like in vim would do the job. Or even a modal approach à la Spacemacs wouldn't be too dumb: Get into modal mode and Spacebar, though that would likely be overkill.
But, oh, well, do consider the modal approach. It's not that dumb for this use case. Though likely orthogonal to what Textual has in mind.
Thanks, this is useful to know; we'll think on a better binding, or at least an additional binding that is more portable.
There is a related but slightly different issue with the Swedish key layout. Using textual keys
, the combination Ctrl + Backslash
is reported as two separate keypresses:
Key(key='ctrl+@', character='\x00', name='ctrl_@', is_printable=False)
Key(key='backslash', character='\\', name='backslash', is_printable=True)
If I switch to an English (UK) layout, the combination Ctrl + Backslash
is registered as a separate keypress and a non-printable character:
Key(key='ctrl+@', character='\x00', name='ctrl_@', is_printable=False)
Key(key='ctrl+backslash', character='\x1c', name='ctrl_backslash', is_printable=False)
This means that even if you are pressing the right keys on a Swedish keyboard, the palette command is still not working.
@RasmusB Which OS(s)?
Windows 10
If you want to recreate it, you can switch to the Swedish keyboard layout. Backslash is entered by holding AltGr
and pressing the key to the right of 0
:
I would honestly suggest a cross platform solution. Esc
seems to me to be the quintessential key for that kind of situation.
Is there a way to hack a replacement of Ctrl+\
into Esc
with the current codebase ?
@gl-yziquel We'll obviously look for and settle on a choice that works in all places, although Esc would be a really bad choice, I think -- plenty of applications use it as the "escape out of here" key.
Thanks all for letting us know it's not a great choice and for adding more detail; we'll be sure to find a more portable selection.
Thanks for looking into it. Maybe this should be escalated to a bug since the current implementation doesn't work with some layouts?
Any advice as to how this keybinding could be modified for a quick fix, locally ?
@gl-yziquel The calling of the command palette is an action on App
; so you can add an apporpriate binding to your app that is bound to "command_palette"
.
One more remark. Using that same french keyboard with swiss french mapping over ssh (osx connecting over ssh to ubuntu) does not even allow me to get command palette with such keybindings. Without ssh, it's ok. With ssh, it's not.
As to the alternate key binding. Using BINDINGS = [("escape", "command_palette", "Command Palette")]
adds the ESC
keybinding to command_palette
BUT it does not remove the Ctrl+\
keybinding. So, now, two keybinding are attached to command_palette
. Which is undesirable.
(And, yes, using ESC
does seem like a bad idea. I'll check when and how it bites me.)
Would it be strange to propose cmd/ctrl-shift-p? The default Atom / Nuclide / VS Code command palette binding? Or PyCharm's cmd/ctrl-shift-a?
@davidfokkema Have you tried those with textual keys
in some of the common terminals?
Apparently... I had not.🥲
The command palette binding was changed to ctrl+p
in Textual v0.77.0, so I wonder if this issue can be closed?
@TomJGooding I don't react quickly to issues, and I have moved on. I don't have time to test that code, so I leave that to the judgement of the repo owners.