1
0
Fork 0
forked from wry/wry

config: allow configuring repeat rates via toml

This commit is contained in:
Julian Orth 2024-04-05 17:25:07 +02:00
parent b374947b45
commit 1a9b7146fd
9 changed files with 241 additions and 2 deletions

View file

@ -284,6 +284,23 @@
"keymap"
]
},
{
"description": "Sets the keyboard repeat rate.\n\n- Example:\n\n ```toml\n [shortcuts]\n alt-x = { type = \"set-repeat-rate\", rate = { rate = 25, delay = 250 } }\n ```\n",
"type": "object",
"properties": {
"type": {
"const": "set-repeat-rate"
},
"rate": {
"description": "The rate.",
"$ref": "#/$defs/RepeatRate"
}
},
"required": [
"type",
"rate"
]
},
{
"description": "Sets the status command.\n\n- Example:\n\n ```toml\n [shortcuts]\n alt-j = { type = \"set-status\", status = { exec = \"i3status\" } }\n ```\n",
"type": "object",
@ -418,6 +435,10 @@
"description": "The keymap to use.\n\n- Example:\n\n ```toml\n keymap = \"\"\"\n xkb_keymap {\n xkb_keycodes { include \"evdev+aliases(qwerty)\" };\n xkb_types { include \"complete\" };\n xkb_compat { include \"complete\" };\n xkb_symbols { include \"pc+us+inet(evdev)\" };\n };\n \"\"\"\n ```\n",
"$ref": "#/$defs/Keymap"
},
"repeat-rate": {
"description": "The keyboard repeat rate.\n\n- Example:\n \n ```toml\n repeat-rate = { rate = 25, delay = 250 }\n ```\n",
"$ref": "#/$defs/RepeatRate"
},
"shortcuts": {
"description": "The compositor shortcuts.\n\nThe keys should be in the following format:\n\n```\n(MOD-)*KEYSYM\n```\n\n`MOD` should be one of `shift`, `lock`, `ctrl`, `mod1`, `mod2`, `mod3`, `mod4`,\n`mod5`, `caps`, `alt`, `num`, or `logo`.\n\n`KEYSYM` should be the name of a keysym. The authorative location for these names\nis [1] with the `XKB_KEY_` prefix removed.\n\nThe keysym should be the unmodified keysym. E.g. `shift-q` not `shift-Q`.\n\n[1]: https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h\n\n- Example:\n\n ```toml\n [shortcuts]\n alt-q = \"quit\"\n ```\n",
"type": "object",
@ -985,6 +1006,24 @@
}
]
},
"RepeatRate": {
"description": "Describes a keyboard repeat rate.\n\n- Example:\n\n ```toml\n repeat-rate = { rate = 25, delay = 250 }\n ```\n",
"type": "object",
"properties": {
"rate": {
"type": "integer",
"description": "The number of times to repeat per second."
},
"delay": {
"type": "integer",
"description": "The number of milliseconds after a key is pressed before repeating begins.\n"
}
},
"required": [
"rate",
"delay"
]
},
"SimpleActionName": {
"type": "string",
"description": "The name of a `simple` Action.\n\n- Example:\n\n ```toml\n [shortcuts]\n alt-q = \"quit\"\n ```\n",

View file

@ -405,6 +405,25 @@ This table is a tagged union. The variant is determined by the `type` field. It
The value of this field should be a [Keymap](#types-Keymap).
- `set-repeat-rate`:
Sets the keyboard repeat rate.
- Example:
```toml
[shortcuts]
alt-x = { type = "set-repeat-rate", rate = { rate = 25, delay = 250 } }
```
The table has the following fields:
- `rate` (required):
The rate.
The value of this field should be a [RepeatRate](#types-RepeatRate).
- `set-status`:
Sets the status command.
@ -652,6 +671,18 @@ The table has the following fields:
The value of this field should be a [Keymap](#types-Keymap).
- `repeat-rate` (optional):
The keyboard repeat rate.
- Example:
```toml
repeat-rate = { rate = 25, delay = 250 }
```
The value of this field should be a [RepeatRate](#types-RepeatRate).
- `shortcuts` (optional):
The compositor shortcuts.
@ -2038,6 +2069,38 @@ The table has the following fields:
The value of this field should be a string.
<a name="types-RepeatRate"></a>
### `RepeatRate`
Describes a keyboard repeat rate.
- Example:
```toml
repeat-rate = { rate = 25, delay = 250 }
```
Values of this type should be tables.
The table has the following fields:
- `rate` (required):
The number of times to repeat per second.
The value of this field should be a number.
The numbers should be integers.
- `delay` (required):
The number of milliseconds after a key is pressed before repeating begins.
The value of this field should be a number.
The numbers should be integers.
<a name="types-SimpleActionName"></a>
### `SimpleActionName`

View file

@ -382,6 +382,21 @@ Action:
description: The keymap.
required: true
ref: Keymap
set-repeat-rate:
description: |
Sets the keyboard repeat rate.
- Example:
```toml
[shortcuts]
alt-x = { type = "set-repeat-rate", rate = { rate = 25, delay = 250 } }
```
fields:
rate:
description: The rate.
required: true
ref: RepeatRate
set-status:
description: |
Sets the status command.
@ -1649,6 +1664,17 @@ Config:
};
"""
```
repeat-rate:
ref: RepeatRate
required: false
description: |
The keyboard repeat rate.
- Example:
```toml
repeat-rate = { rate = 25, delay = 250 }
```
shortcuts:
kind: map
values:
@ -1983,3 +2009,27 @@ Idle:
integer_only: true
minimum: 0
required: false
RepeatRate:
kind: table
description: |
Describes a keyboard repeat rate.
- Example:
```toml
repeat-rate = { rate = 25, delay = 250 }
```
fields:
rate:
kind: number
integer_only: true
required: true
description: The number of times to repeat per second.
delay:
kind: number
integer_only: true
required: true
description: |
The number of milliseconds after a key is pressed before repeating begins.