Files
telegram-tui/HOTKEYS.md
Mikhail Kilin bea0bcbed0 feat: implement desktop notifications with comprehensive filtering
Implemented Phase 10 (Desktop Notifications) with three stages:
notify-rust integration, smart filtering, and production polish.

Stage 1 - Base Implementation:
- Add NotificationManager module (src/notifications.rs, 350+ lines)
- Integrate notify-rust 4.11 with feature flag "notifications"
- Implement NotificationsConfig in config.toml (enabled, only_mentions, show_preview)
- Add notification_manager field to TdClient
- Create configure_notifications() method for config integration
- Hook into handle_new_message_update() to send notifications
- Send notifications for messages outside current chat
- Format notification body with sender name and message preview

Stage 2 - Smart Filtering:
- Sync muted chats from Telegram (sync_muted_chats method)
- Filter muted chats from notifications automatically
- Add MessageInfo::has_mention() to detect @username mentions
- Implement only_mentions filter (notify only when mentioned)
- Beautify media labels with emojis (📷 📹 🎤 🎨 📎 etc.)
- Support 10+ media types in notification preview

Stage 3 - Production Polish:
- Add graceful error handling (no panics on notification failure)
- Implement comprehensive logging (tracing::debug!/warn!)
- Add timeout_ms configuration (0 = system default)
- Add urgency configuration (low/normal/critical, Linux only)
- Platform-specific #[cfg] for urgency support
- Log all notification skip reasons at debug level

Hotkey Change:
- Move profile view from 'i' to Ctrl+i to avoid conflicts

Technical Details:
- Cross-platform support (macOS, Linux, Windows)
- Feature flag for optional notifications support
- Graceful fallback when notifications unavailable
- LRU-friendly muted chats sync
- Test coverage for all core notification logic
- All 75 tests passing

Files Changed:
- NEW: src/notifications.rs - Complete NotificationManager
- NEW: config.example.toml - Example configuration with notifications
- Modified: Cargo.toml - Add notify-rust 4.11 dependency
- Modified: src/config/mod.rs - Add NotificationsConfig struct
- Modified: src/tdlib/types.rs - Add has_mention() method
- Modified: src/tdlib/client.rs - Add notification integration
- Modified: src/tdlib/update_handlers.rs - Hook notifications
- Modified: src/config/keybindings.rs - Change profile to Ctrl+i
- Modified: tests/* - Add notification config to tests

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 01:27:44 +03:00

145 lines
5.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Горячие клавиши tele-tui
## Общая навигация
| Клавиша | Русская раскладка | Действие |
|---------|-------------------|----------|
| `↑` / `k` | `р` | Вверх по списку |
| `↓` / `j` | `о` | Вниз по списку |
| `Enter` | | Открыть чат / Отправить сообщение |
| `Esc` | | Закрыть чат / Отменить действие |
| `Ctrl+C` | | Выход из приложения |
| `Ctrl+R` | | Обновить список чатов |
## Папки и поиск
| Клавиша | Действие |
|---------|----------|
| `1-9` | Переключение между папками Telegram |
| `Ctrl+S` | Открыть поиск по чатам |
| `Ctrl+F` | Открыть поиск в текущем чате |
| `n` | Следующий результат поиска |
| `N` | Предыдущий результат поиска |
## Работа с сообщениями
### Навигация и выбор
| Клавиша | Действие |
|---------|----------|
| `↑/↓` | Скролл сообщений (в открытом чате) |
| `↑` | Выбор сообщения (при пустом поле ввода) |
| `Esc` | Отменить выбор |
### Действия с сообщениями
| Клавиша | Русская раскладка | Действие |
|---------|-------------------|----------|
| `Enter` | | Редактировать выбранное сообщение |
| `r` | `к` | Ответить на сообщение (Reply) |
| `f` | `а` | Переслать сообщение (Forward) |
| `d` / `Delete` | `в` | Удалить сообщение |
| `y` | `н` | Копировать текст в буфер обмена |
| `e` | `у` | Добавить реакцию (Emoji picker) |
| `Ctrl+i` | `Ctrl+ш` | Открыть профиль чата/пользователя |
## Модалки подтверждения
### Удаление сообщения
| Клавиша | Русская раскладка | Действие |
|---------|-------------------|----------|
| `y` / `Enter` | `н` | Подтвердить удаление |
| `n` / `Esc` | `т` | Отменить удаление |
## Emoji Picker (реакции)
| Клавиша | Действие |
|---------|----------|
| `←` | Влево по сетке эмодзи |
| `→` | Вправо по сетке эмодзи |
| `↑` | Вверх по сетке эмодзи |
| `↓` | Вниз по сетке эмодзи |
| `Enter` | Добавить/удалить реакцию |
| `Esc` | Закрыть emoji picker |
## Редактирование текста
### Навигация по тексту
| Клавиша | Действие |
|---------|----------|
| `←` | Курсор влево |
| `→` | Курсор вправо |
| `Home` | Курсор в начало строки |
| `End` | Курсор в конец строки |
### Редактирование
| Клавиша | Действие |
|---------|----------|
| `Backspace` | Удалить символ слева от курсора |
| `Delete` | Удалить символ справа от курсора |
| `Enter` | Новая строка / Отправить (зависит от контекста) |
## Режимы работы
### Режим списка чатов
- Навигация: `↑/↓`
- Открыть чат: `Enter`
- Поиск: `Ctrl+S`
- Папки: `1-9`
### Режим открытого чата
- Скролл: `↑/↓`
- Выбор сообщения: `↑` (при пустом инпуте)
- Поиск в чате: `Ctrl+F`
- Закрыть чат: `Esc`
### Режим выбора сообщения
- Редактировать: `Enter`
- Ответить: `r` / `к`
- Переслать: `f` / `а`
- Удалить: `d` / `в` / `Delete`
- Копировать: `y` / `н`
- Реакция: `e` / `у`
- Отменить: `Esc`
### Режим редактирования
- Редактировать текст: см. "Редактирование текста"
- Отправить: `Enter`
- Отменить: `Esc`
### Режим ответа (Reply)
- Редактировать ответ: см. "Редактирование текста"
- Отправить: `Enter`
- Отменить: `Esc`
### Режим пересылки (Forward)
- Выбрать чат: `↑/↓`
- Переслать: `Enter`
- Отменить: `Esc`
## Поддержка русской раскладки
Все основные vim-клавиши поддерживают русскую раскладку:
| Английская | Русская | Действие |
|------------|---------|----------|
| `h` | `р` | Влево |
| `j` | `о` | Вниз |
| `k` | `л` | Вверх |
| `l` | `д` | Вправо |
| `r` | `к` | Reply |
| `f` | `а` | Forward |
| `d` | `в` | Delete |
| `y` | `н` | Copy (Yank) |
| `e` | `у` | Emoji reaction |
## Подсказки
- Текущие доступные команды всегда отображаются в нижней части экрана (footer)
- При открытой модалке доступны только действия этой модалки
- `Esc` всегда отменяет текущее действие и возвращает на шаг назад
- Блочный курсор █ показывает текущую позицию при редактировании текста