open_file: file associations, default editor and 'Open with' dialog

- New open_file IPC message: resolves [open_with] extension mapping,
  falls back to default_editor for known text formats, otherwise opens
  an 'Öppna med' dialog where the user types a command (live preview
  of the full command line, path tail-truncated so the extension stays
  visible) and chooses open-once or save-as-default for the extension
  (persisted to [open_with] in config.toml)
- default_editor configurable in the settings dialog (new Editor row
  with inline text editing) and in config.toml; '{}' in commands is
  replaced with the shell-quoted path
- Documented in SOCKET_API.md; integration suite covers dialog →
  save-association → direct open (38/38)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 20:33:07 +02:00
parent 4cc33cf62c
commit 10ef87879a
7 changed files with 375 additions and 14 deletions

View File

@@ -176,6 +176,21 @@ Close the window with the given ID.
{ "type": "close_window", "window_id": 3, "request_id": "req-4" }
```
### `open_file`
Ask TUI-WM to open a file. Resolution order: `[open_with]` association
for the file extension → `default_editor` (for known text formats) →
an interactive "Öppna med" dialog where the user types a command and
can save it as the default for that extension. Replies with
`window_opened` (the id of the spawned window or dialog).
```json
{ "type": "open_file", "path": "/home/user/anteckningar.md", "request_id": "o1" }
```
In commands, `{}` is replaced with the (shell-quoted) file path;
otherwise the path is appended.
### `set_background`
Set or remove the desktop background image (requires Kitty graphics protocol support in the host terminal).