beeware / beeware/toga

Keyboard layout for shortcuts

Open
#2,428 10 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
5.4k
Forks
827
Avg merge
15h 39m
Merged PRs (30d)
40

Description

### What is the problem or limitation you are having?

I was not sure whether to classify this as a feature request or a bug, I think it depends on the viewpoint.

Basically, right now, if I assign a hotkey for a command, say Key.MOD_1+"1", what I actually need to press to get it triggered is Ctrl+Shift+1, because the Slovak keyboard layout I'm using has the character "+" where the English keyboard has 1, and Shift+"+" produces 1 on our keyboard.

I would guess that Key.MOD_1+Key.EXCLAMATION yields a similar behavior on the English layout, i.e. you need to press Ctrl+Shift+1. Which sort of makes sense in this particular case, but normally, I would rather define this like Key.MOD_1+Key.SHIFT+"1" (it seems there is actually no value for 1 on the Key enum, I do see Key.NUMPAD_1 there but the number row is only represented by the special symbols, so this is what works instead).

Does Toga have a guidelined way of approaching this?

### Describe the solution you'd like

For me personally, it makes more sense to define shortcuts through hardware keys, because various countries have very differing stickers on their keyboards, but actually very similar hardware layouts, so when I'm designing a keyboard-centric app, I can select shortcuts based on what's physically most convenient to press and makes most sense, so when my users install my app, most of them will have the fine-tuned logical control system I designed for them out of the box.

While, if I used localized shortcuts, they could be giving perfect sense on my keyboard, but be absolutely out of reah for many other countries, or not possible to press at all (like Ctrl+Ľ or Ctrl+Ô on an English keyboard).

### Describe alternatives you've considered

_

### Additional context

### Environment

- Operating system: Ubuntu Mate 22.04 64-bit
- Toga: 0.4.3.dev275+g5badd9083

Contributor guide

Open the contributing guide

Research direction

Start by locating Toga's Key enum and the code that registers and dispatches command hotkeys. Reproduce the reported Key.MOD_1+"1" behavior on the Slovak and English layouts, then compare how number-row and hardware-key input are represented. Done means the shortcut behavior and API guidance are consistent across keyboard layouts, with tests covering the reported cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.