Skip to content

WaySwitch 2.0.0a1 — первая альфа переписанной версии / first alpha of the rewrite

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 23 Sep 02:37
· 67 commits to main since this release

WaySwitch v2.0.0a1

Русский

Что это за релиз

Первая альфа-версия WaySwitch v2 — полного переписывания проекта с нуля.
Прототип v1 (демон и установщик в корне репозитория, без пакетирования и
без юнит-тестов) выброшен целиком; текущая кодовая база не разделяет с
ним ни строки кода. Это первый публичный релиз новой архитектуры: демон
на evdev/uinput, детектор на словаре и символьных триграммах, два
бэкенда переключения раскладки, GTK4-интерфейс, .deb-пакет.

Что внутри

  • Ядро демона — чтение клавиатуры через evdev без захвата
    устройства, буфер слова/фразы с учётом Shift/CapsLock, оркестрация
    решения и исполнения без привязки к GLib main loop (тестируется без
    живого GNOME), охрана сессии (пауза на заблокированном экране).
  • Детектор — решение «оставить/исправить» по словарю и модели
    символьных триграмм, с стоп-правилами для цифр, смешанных алфавитов,
    camelCase, путей и URL, коротких слов вне словаря; ранний триггер URL
    (http://, https://, ftp://) без ожидания пробела. Качество на
    отложенной части словаря: ru — полнота 96,5 %, ложные срабатывания
    0,07 %; en — полнота 96,8 %, ложные срабатывания 0,07 %.
  • Бэкенды переключения раскладки — IBus (IBus.Bus, работает всегда),
    собственное расширение GNOME Shell (точное состояние, синхронное
    переключение, печать keysym без ожидания сигнала), резервный
    хоткей-эмулятор. Выбор бэкенда — автоматический либо задаётся в
    конфиге (prefer).
  • GUI и трей — окно настроек на GTK4/libadwaita (статус, настройки,
    исключения, автозапуск, тест-поле) и значок в трее
    (StatusNotifierItem + dbusmenu) с переключателем автоисправления,
    паузой, «исправить последнее слово» и выходом.
  • Расширение GNOME Shell — ESM-модуль (wayswitch@siberia.ru),
    shell-version 46–49, устанавливается пакетом системно и включается
    отдельно.
  • CLI, doctor, dry-run — подкоманды run/dry-run/doctor/
    devices/pause/resume/fix/status/gui/version;
    wayswitch doctor проверяет окружение перед первым запуском (сессия
    Wayland, модули, раскладки, IBus, /dev/uinput, правило udev);
    dry-run показывает решения детектора без каких-либо действий на
    экране.
  • Упаковка — архитектурно-независимый .deb (tools/build_deb.sh,
    без debhelper) с постинстall-подсказкой и корректным удалением, плюс
    packaging/install.sh/uninstall.sh для Fedora и сборки из
    исходников.
  • Сквозной тест — tests/e2e_vm.py, отдельный скрипт для ручного
    прогона на живой VM с открытым текстовым полем в фокусе (не часть
    pytest).

Установка

url=$(curl -s https://api.github.com/repos/Wetoshkin/WaySwitch/releases/latest | grep -o 'https://[^"]*\.deb' | head -1)
wget "$url"
sudo apt install ./wayswitch_*.deb

Важная оговорка

Ничего из этого пока не запускалось на живом GNOME. Вся проверка —
юнит-тесты на Windows и в CI (ubuntu-latest); сборка и установка
.deb проверены тоже только в CI. Прежде чем полагаться на автоисправление
в бою:

  1. Выполните wayswitch doctor и убедитесь, что все обязательные проверки
    зелёные.
  2. Проверьте гипотезу про IBus (открытый вопрос спецификации 13.1):
    ibus engine xkb:ru::rus может не переключать саму раскладку GNOME
    Shell — источник истины для Wayland на этот счёт сам Shell. Если
    индикатор раскладки в панели не меняется, авторежим заработает только
    с расширением (gnome-extensions enable wayswitch@siberia.ru,
    [backend] prefer = "shell" в конфиге).
  3. Пройдите чек-лист первого запуска целиком — docs/testing-vm.md.

Известные ограничения

  • Демон не видит текст в полях паролей — на время ввода пароля используйте
    паузу.
  • Поля с автодополнением (адресная строка браузера) могут вести себя
    неожиданно при перепечатке.
  • Прерванное исправление (физическое нажатие во время перепечатки) не
    откатывается.
  • Правило udev uaccess даёт чтение событий клавиатуры любой программе
    текущего пользователя, не только WaySwitch.
  • Только GNOME на Wayland; KDE и Sway/Hyprland — в планах.

Требования

  • GNOME 46–49 на Wayland.
  • Ровно две раскладки ввода: одна ru*, одна латинская.
  • Ubuntu 24.04+ или Fedora 40+.
  • Python 3.11+.

Как сообщить о проблеме

Заводите issue на GitHub и прикладывайте вывод wayswitch doctor и
последние строки journalctl --user -u wayswitch — без них разобраться
в проблеме на конкретном окружении почти невозможно.

Тесты и CI

150+ тестов (pytest), чистый ruff. На Windows пропускаются (skipif)
только два теста keymap.py, завязанных на настоящий libxkbcommon. CI
на ubuntu-latest дополнительно собирает .deb и устанавливает его
(apt install ./...), проверяя пакет целиком, а не только код.


English

What this release is

The first alpha of WaySwitch v2 — a complete rewrite from scratch. The v1
prototype (a daemon and installer that lived at the repository root, with
no packaging and no unit tests) has been discarded entirely; the current
codebase shares no code with it. This is the first public release of the
new architecture: an evdev/uinput daemon, a dictionary-and-trigram
detector, two layout-switching backends, a GTK4 UI, and a .deb package.

What's inside

  • Daemon core — reads the keyboard through evdev without grabbing
    the device, buffers the current word/phrase while tracking
    Shift/CapsLock, and orchestrates decision-making and execution
    independently of the GLib main loop (so it's testable without a live
    GNOME session), plus session guarding (nothing fires while the screen
    is locked).
  • Detector — a keep/fix decision from a dictionary lookup and a
    character-trigram language model, with stop rules for digits, mixed
    alphabets, camelCase, paths and URLs, and short out-of-dictionary
    words; an early URL trigger (http://, https://, ftp://) that
    fires without waiting for a space. Measured quality on a held-out slice
    of the dictionary: ru — 96.5% recall, 0.07% false-positive rate; en —
    96.8% recall, 0.07% false-positive rate.
  • Layout-switching backends — IBus (IBus.Bus, always available), a
    dedicated GNOME Shell extension (exact state, synchronous switching,
    keysym typing with no wait for a signal), and a hotkey-emulation
    fallback. The backend is picked automatically or forced via config
    (prefer).
  • GUI and tray — a GTK4/libadwaita settings window (status, settings,
    exceptions, autostart, a test field) and a tray icon
    (StatusNotifierItem + dbusmenu) with an autocorrect toggle, pause,
    "fix last word", and quit.
  • GNOME Shell extension — an ESM module (wayswitch@siberia.ru),
    shell-version 46–49, installed system-wide by the package and enabled
    separately.
  • CLI, doctor, dry-run — the run/dry-run/doctor/devices/
    pause/resume/fix/status/gui/version subcommands;
    wayswitch doctor checks the environment before the first run
    (Wayland session, modules, layouts, IBus, /dev/uinput, the udev
    rule); dry-run shows the detector's decisions without touching the
    screen.
  • Packaging — an architecture-independent .deb
    (tools/build_deb.sh, no debhelper) with a postinst hint and clean
    removal, plus packaging/install.sh/uninstall.sh for Fedora and
    building from source.
  • End-to-end test — tests/e2e_vm.py, a standalone script for a
    manual run on a live VM with a text field focused (not part of
    pytest).

Install

url=$(curl -s https://api.github.com/repos/Wetoshkin/WaySwitch/releases/latest | grep -o 'https://[^"]*\.deb' | head -1)
wget "$url"
sudo apt install ./wayswitch_*.deb

Important caveat

None of this has run on a live GNOME session yet. Everything has been
verified through unit tests on Windows and in CI (ubuntu-latest); the
.deb build and install have likewise only been exercised in CI. Before
relying on autocorrect for real work:

  1. Run wayswitch doctor and make sure every required check is green.
  2. Check the IBus hypothesis (open question 13.1 in the design spec):
    ibus engine xkb:ru::rus may not actually switch GNOME Shell's own
    layout — on Wayland, Shell itself is the source of truth for that. If
    the layout indicator in the panel doesn't change, autocorrect will
    only work with the extension enabled
    (gnome-extensions enable wayswitch@siberia.ru,
    [backend] prefer = "shell" in the config).
  3. Work through the full first-run checklist — docs/testing-vm.md.

Known limitations

  • The daemon can't see text in password fields — pause it while typing a
    password.
  • Autocompletion fields (a browser address bar) may behave unexpectedly
    while WaySwitch is retyping into them.
  • An interrupted correction (a physical keypress during retyping) is not
    rolled back.
  • The uaccess udev rule lets any program running as the current user
    read keystroke events, not just WaySwitch.
  • GNOME on Wayland only for now; KDE and Sway/Hyprland are on the
    roadmap.

Requirements

  • GNOME 46–49 on Wayland.
  • Exactly two input layouts: one ru*, one Latin.
  • Ubuntu 24.04+ or Fedora 40+.
  • Python 3.11+.

Reporting problems

Please file a GitHub issue with the output of wayswitch doctor and the
tail of journalctl --user -u wayswitch attached — without them it's
nearly impossible to diagnose an issue on a specific environment.

Tests and CI

150+ tests (pytest), clean ruff. On Windows only two keymap.py tests
that need a real libxkbcommon are skipped. CI on ubuntu-latest
additionally builds the .deb and installs it (apt install ./...),
exercising the whole package, not just the code.