Skip to content

Push-to-talk transcription daemon for Wayland (Sway, Hyprland, niri, COSMIC) using Moonshine

License

Notifications You must be signed in to change notification settings

hiasinho/hammertalk

Repository files navigation

Hammertalk

Hammertalk

CI

Push-to-talk transcription daemon for Wayland (Sway, Hyprland, niri, COSMIC) with multiple engine support.

Quick Install

curl -fsSL https://raw.githubusercontent.com/hiasinho/hammertalk/master/install-remote.sh | sh

This installs Rust (if needed), builds from source, downloads the model, and sets up the systemd service.

Arch Linux (AUR)

yay -S hammertalk-bin    # pre-built binary
yay -S hammertalk-git    # build from source

After installing, download the model:

/usr/share/hammertalk/download-model.sh

Manual Install

git clone https://github.com/hiasinho/hammertalk
cd hammertalk
./download-model.sh   # Download model (~106MB)
./install.sh          # Build and install

Update

Re-run the quick install script to update to the latest version:

curl -fsSL https://raw.githubusercontent.com/hiasinho/hammertalk/master/install-remote.sh | sh

Engines

Hammertalk supports multiple transcription engines:

Engine Model Size Notes
moonshine-tiny ~106MB Default. Fast, good accuracy.
whisper-tiny ~75MB Smaller model, decent accuracy.
whisper-base ~148MB Better accuracy than tiny.

Select an engine via CLI flag, environment variable, or config file (in priority order):

hammertalk --engine whisper-tiny
# or
HAMMERTALK_ENGINE=whisper-base hammertalk

Or set it persistently in ~/.config/hammertalk/config.toml:

engine = "whisper-tiny"

Download the model for your chosen engine:

./download-model.sh whisper-tiny    # or whisper-base, moonshine-tiny, all

For systemd, uncomment and set HAMMERTALK_ENGINE in the service file.

Usage

Systemd (recommended)

systemctl --user start hammertalk
systemctl --user enable hammertalk  # auto-start on login

Manual

~/.local/bin/hammertalk

Control

hammertalk-ctl start   # begin recording
hammertalk-ctl stop    # stop and transcribe
hammertalk-ctl status  # check if running

Keybindings

Sway (~/.config/sway/config):

bindsym --no-repeat $mod+t exec ~/.local/bin/hammertalk-ctl start
bindsym --release $mod+t exec ~/.local/bin/hammertalk-ctl stop

Hyprland (~/.config/hypr/hyprland.conf):

bind = $mainMod, t, exec, ~/.local/bin/hammertalk-ctl start
bindrt = $mainMod, t, exec, ~/.local/bin/hammertalk-ctl stop

niri (~/.config/niri/config.kdl):

binds {
    Mod+T { spawn "sh" "-c" "~/.local/bin/hammertalk-ctl start"; }
    Mod+T release { spawn "sh" "-c" "~/.local/bin/hammertalk-ctl stop"; }
}

COSMIC: Use Settings → Keyboard → Shortcuts to add custom bindings for ~/.local/bin/hammertalk-ctl start (key press) and ~/.local/bin/hammertalk-ctl stop (key release). This one's for you, Marek. 😉

Hold the key, speak, release. Text appears at cursor.

Waybar

Add a custom module to your waybar config:

"custom/hammertalk": {
    "exec": "~/.local/bin/hammertalk status --follow --format json",
    "return-type": "json",
    "format": "{}",
    "tooltip": true,
    "on-click": "systemctl --user restart hammertalk",
    "on-click-right": "systemctl --user stop hammertalk"
}

Style by state in ~/.config/waybar/style.css:

#custom-hammertalk.recording { color: #ff5555; }
#custom-hammertalk.transcribing { color: #f1fa8c; }
#custom-hammertalk.stopped { color: #6272a4; }

You can also check status from the command line:

hammertalk status                       # one-shot text output
hammertalk status --follow --format json # continuous JSON stream

Requirements

  • ydotool (and ydotoold running)
  • PipeWire or PulseAudio

Logs

journalctl --user -u hammertalk -f

Build from source

cargo build --release

Testing

cargo test          # run tests
./check.sh          # run all checks (format, clippy, tests, audit)

About

Push-to-talk transcription daemon for Wayland (Sway, Hyprland, niri, COSMIC) using Moonshine

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •