Optional PC key blocks: function row, navigation, numeric keypad

- Template sections placed above or to the right of the typing keys;
  the user picks any mix in settings, typing keys included
- keysym keys send XKB keysyms on press, optionally repeating
- Geometry lays blocks side by side with one key unit; stretch keys are
  resolved at layout time so composed blocks line up
- Toggling a block resizes the window so keys keep their size

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 21:18:10 +02:00
co-authored by Claude Opus 5.5
parent e532f5c072
commit 88338fde22
22 changed files with 521 additions and 101 deletions
+18 -2
View File
@@ -16,6 +16,7 @@ enum class KeyType {
Dismiss,
Spacer, // empty room, e.g. the half-key indent of the home row
Letters, // template only: a row of letters from the system keymap
Keysym, // a non-text key (Home, F5, arrows...): sends `keysym`
};
struct KeyDef {
@@ -26,7 +27,9 @@ struct KeyDef {
QStringList alternates; // long-press choices
QString target; // layer to switch to (LayerSwitch only)
qreal width = 1.0; // in key units
bool stretch = false; // grows so the row is as wide as the layer's widest
bool stretch = false; // grows so the row is as wide as its block's widest
quint32 keysym = 0; // Keysym keys only
bool repeat = false; // Keysym keys only: auto-repeat while held
// Letters placeholders only.
int lettersRow = -1; // which keymap row (0 = top)
@@ -48,10 +51,21 @@ struct Layer {
QList<Row> rows;
};
// An optional block of keys next to the main one, shown if the user wants it.
struct Section {
enum class Placement { Above, Right }; // above the main keys, or a column to their right
QString id; // "main" is reserved for the layers
QString name; // shown in settings
Placement placement = Placement::Right;
QList<Row> rows;
};
struct Layout {
QString id;
QString name; // human readable, e.g. "Slovak"
QList<Layer> layers; // the first one is shown by default
QList<Layer> layers; // the main keys; the first one is shown by default
QList<Section> sections;
// Template only: long-press choices for keymap letters, by lowercase letter.
QHash<QString, QStringList> alternates;
@@ -64,3 +78,5 @@ struct Layout {
return nullptr;
}
};
inline const QString MainSectionId = QStringLiteral("main");