diff --git a/cli.py b/cli.py index f642894ae..b09a17355 100644 --- a/cli.py +++ b/cli.py @@ -6500,6 +6500,24 @@ class HermesCLI: self._should_exit = True event.app.exit() + @kb.add('c-z') + def handle_ctrl_z(event): + """Handle Ctrl+Z - suspend process to background (Unix only).""" + import sys + if sys.platform == 'win32': + _cprint(f"\n{_DIM}Suspend (Ctrl+Z) is not supported on Windows.{_RST}") + event.app.invalidate() + return + import os, signal as _sig + from prompt_toolkit.application import run_in_terminal + from hermes_cli.skin_engine import get_active_skin + agent_name = get_active_skin().get_branding("agent_name", "Hermes Agent") + msg = f"\n{agent_name} has been suspended. Run `fg` to bring {agent_name} back." + def _suspend(): + os.write(1, msg.encode()) + os.kill(0, _sig.SIGTSTP) + run_in_terminal(_suspend) + # Voice push-to-talk key: configurable via config.yaml (voice.record_key) # Default: Ctrl+B (avoids conflict with Ctrl+R readline reverse-search) # Config uses "ctrl+b" format; prompt_toolkit expects "c-b" format.