# Menus & shortcuts

Every menu of tratto, every item and every key comes from one file, `menu.json`. The app builds the menu bar, the
context menus, the [keyboard shortcuts sheet](/docs/keyboard-shortcuts) and [Quick Command](/docs/home/quick-command)
from it.

## How an item is declared

```json
{ "command": "view.zen", "label": "menu.view.zen", "shortcut": "meta+control+z", "linux_shortcut": "control+alt+z" }
```

- `command` is one of the commands the app knows; a file that names another is refused.
- `label` is a key of the texts, so the menu follows the language.
- `shortcut` is written with the macOS modifiers (`meta` is `⌘`).
- `scope`, `home` or `ide`, limits a key to one module, where it may reuse a key the rest of the app has.

## Menus that follow the module

The menu bar shows only what belongs to the module on screen. A menu, a submenu or an item may name its modules:

```json
{ "label": "menu.repository", "modes": ["git", "ide"], "groups": [ … ] }
```

- `modes` lists modules by name: `home`, `git`, `ide`, `database`, `agents`, `pm`. An unknown name or an empty list is
  refused.
- Without `modes`, the element shows in every module.
- A group or a menu left empty in a module leaves the bar there. Its keys go with it.

So Database and PM show `File`, `Edit`, `View`, `Window` and `Help`, without `Repository`, `Format` or `Actions`.

## The keys on Linux

On Linux, `⌘` is read as `Ctrl`. When that would collide with what the desktop keeps for itself (the list
`taken_by_desktop`: `Ctrl+Alt+T` and `Ctrl+Alt+L`) or with another item, the item either has a `linux_shortcut` of its
own or no key at all. The [shortcuts reference](/docs/reference/keyboard-shortcuts) shows the result for every item.

## Can I change a key?

Not from the configuration folder yet: `menu.json` ships with the app and is read only from there. Changing a key today
means changing the file in tratto's source and building the app.
