textual icon indicating copy to clipboard operation
textual copied to clipboard

Swiss keyboard is inconvenient to access the palette command.

Open gl-yziquel opened this issue 1 year ago • 14 comments

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.

gl-yziquel avatar Sep 26 '23 10:09 gl-yziquel

Thanks, this is useful to know; we'll think on a better binding, or at least an additional binding that is more portable.

davep avatar Sep 26 '23 10:09 davep

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 avatar Sep 27 '23 06:09 RasmusB

@RasmusB Which OS(s)?

davep avatar Sep 27 '23 06:09 davep

Windows 10

RasmusB avatar Sep 27 '23 06:09 RasmusB

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:

The key to press

RasmusB avatar Sep 27 '23 06:09 RasmusB

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 avatar Sep 27 '23 07:09 gl-yziquel

@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.

davep avatar Sep 27 '23 08:09 davep

Thanks for looking into it. Maybe this should be escalated to a bug since the current implementation doesn't work with some layouts?

RasmusB avatar Sep 27 '23 08:09 RasmusB

Any advice as to how this keybinding could be modified for a quick fix, locally ?

gl-yziquel avatar Sep 27 '23 13:09 gl-yziquel

@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".

davep avatar Sep 27 '23 13:09 davep

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.)

gl-yziquel avatar Sep 27 '23 13:09 gl-yziquel

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 avatar Oct 01 '23 08:10 davidfokkema

@davidfokkema Have you tried those with textual keys in some of the common terminals?

davep avatar Oct 01 '23 08:10 davep

Apparently... I had not.🥲

davidfokkema avatar Oct 01 '23 08:10 davidfokkema

The command palette binding was changed to ctrl+p in Textual v0.77.0, so I wonder if this issue can be closed?

TomJGooding avatar Aug 30 '24 11:08 TomJGooding

@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.

gl-yziquel avatar Aug 30 '24 21:08 gl-yziquel

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

github-actions[bot] avatar Aug 30 '24 21:08 github-actions[bot]