Plugins API¶
Every plugin is a plain Python module that follows a small contract rather than
subclassing a base class. A module is loaded if it exposes a NAME string and a
handle(cmd, core) function; the optional setup(core) hook runs once at
startup, and COMMANDS/DESCRIPTION feed the help screen.
classDiagram
class PluginContract {
<<protocol>>
+str NAME
+str DESCRIPTION
+list COMMANDS
+setup(core)
+handle(cmd, core)
}
class base
class sleep
class system
class media
class files
class apps
class browser
class dictation
class mousegrid
class headtrack
PluginContract <|.. base
PluginContract <|.. sleep
PluginContract <|.. system
PluginContract <|.. media
PluginContract <|.. files
PluginContract <|.. apps
PluginContract <|.. browser
PluginContract <|.. dictation
PluginContract <|.. mousegrid
PluginContract <|.. headtrack
note for base "zz_base.py — loads last; help and exit fallback"
note for mousegrid "00_mousegrid.py — numeric prefix loads it early"
note for headtrack "00_eyetrack.py — numeric prefix loads it early"
handle returns True when it consumed the command, False to signal the
daemon to exit, or None to pass the command to the next plugin. Load order is
alphabetical, so numeric prefixes (00_) load a plugin early and the zz_
prefix loads the base plugin last as the catch-all for help and exit.
base (zz_base)¶
plugins.zz_base
¶
Base Plugin - Help and Exit.
setup
¶
handle
¶
Handle the help and exit commands; return None to pass others through.
Returns False to signal the daemon to exit, True if help was shown, or None when the command is for another plugin.
Source code in src/plugins/zz_base.py
show_help
¶
List every plugin's commands on the terminal.
Printed rather than logged: it is the direct reply to an explicit "help" request (the spoken reply tells the user to read the terminal), so it must appear regardless of the configured log verbosity.
Source code in src/plugins/zz_base.py
sleep¶
plugins.sleep
¶
Sleep Plugin - Deactivate the assistant by voice.
"Go to sleep" (or "stop listening") releases the microphone and stops wake-word detection until the user reactivates EasySpeak from the GNOME tray indicator. It pairs with that panel icon, which only appears while the assistant is asleep (the one way back, since voice control is off until reactivated).
handle
¶
Deactivate the assistant on a sleep phrase; return None otherwise.
Source code in src/plugins/sleep.py
system¶
plugins.system
¶
System Plugin - Volume, brightness, do not disturb.
setup
¶
volume_up
¶
volume_down
¶
volume_mute
¶
volume_max
¶
volume_min
¶
brightness_up
¶
brightness_down
¶
dnd_on
¶
dnd_off
¶
Disable do-not-disturb by showing notification banners again.
handle
¶
Route a volume/brightness/DND command; return None if none matched.
Source code in src/plugins/system.py
media¶
plugins.media
¶
Media Plugin - Playback controls via MPRIS.
setup
¶
get_media_players
¶
Return the bus names of all running MPRIS media players.
Source code in src/plugins/media.py
media_control
¶
Send an MPRIS action (play/pause/next/previous) to every running player.
Returns False if no player is running or the action is unknown.
Source code in src/plugins/media.py
handle
¶
Map a playback command to an MPRIS action; return None if not media.
Source code in src/plugins/media.py
files¶
plugins.files
¶
Files Plugin - Open folders in file manager.
setup
¶
open_folder
¶
Open a folder in the first available file manager; False if none found.
Source code in src/plugins/files.py
handle
¶
Open a known folder when the command names one; return None otherwise.
Source code in src/plugins/files.py
apps¶
plugins.apps
¶
Apps Plugin - Launch and close applications.
setup
¶
find_app
¶
Find app - returns (type, id).
Source code in src/plugins/apps.py
launch_app
¶
Launch the named app (flatpak or local binary); False if not found.
Source code in src/plugins/apps.py
close_app
¶
Close the named app (flatpak kill or pkill); False if not found.
Source code in src/plugins/apps.py
handle
¶
Open or close an app named in the command; return None if none matched.
Source code in src/plugins/apps.py
browser¶
plugins.browser
¶
Browser Plugin - Qutebrowser voice control via IPC.
ensure_qutebrowser_config
¶
Append any missing required lines to qutebrowser's config.py.
Preserves everything else the user has written. Tolerates read-only configs (e.g. Nix Home-Manager symlinks into /nix/store): on a write failure we emit a polite note telling the user which lines to add themselves, rather than crashing startup.
Source code in src/plugins/browser.py
setup
¶
qb
¶
qb_open
¶
parse_hint_numbers
¶
Extract hint numbers from spoken words.
looks_like_hint
¶
Check if command looks like a hint number (short, mostly digits/number words).
Source code in src/plugins/browser.py
parse_hint_number
¶
Parse spoken numbers into a hint string ('zero two' -> '02').
Source code in src/plugins/browser.py
parse_spoken_url
¶
Convert spoken URL to actual URL.
'claude dot ai' -> 'https://claude.ai'.
Source code in src/plugins/browser.py
listen_for_hint
¶
Listen for hint number after showing hints.
Source code in src/plugins/browser.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
handle
¶
Enter browser mode on a browser command; return None otherwise.
A matching command launches qutebrowser (if needed) and runs the continuous browser-mode loop; reserved global commands (sleep/quit) are passed through. Outside the explicit "open browser", navigation commands are only acted on when a browser is already running, so ambiguous words can't open one.
Source code in src/plugins/browser.py
browser_mode
¶
Continuous listening for browser commands.
Source code in src/plugins/browser.py
handle_browser_command
¶
Execute a single in-browser command; None if it isn't recognised.
Source code in src/plugins/browser.py
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | |
dictation¶
plugins.dictation
¶
Dictation Plugin - Voice to text via AT-SPI.
ensure_gnome_accessibility
¶
Enable GNOME's toolkit-accessibility for the AT-SPI bridge.
Silently skipped if gsettings isn't on PATH or the schema isn't installed (i.e. user isn't on GNOME). Warns if it's present but the flip fails. Tells the user to re-login when newly enabled.
Source code in src/plugins/dictation.py
setup
¶
Store the core reference and enable the GNOME accessibility bridge.
Source code in src/plugins/dictation.py
atspi_python
¶
Path to the interpreter that runs the AT-SPI helper.
The helper needs PyGObject and the AT-SPI typelib, which the app's own venv usually
lacks. EASYSPEAK_ATSPI_PYTHON lets the packaging point at an interpreter that has
them (the Nix flake sets it); otherwise we fall back to the system python3, where
distro packages like python3-gi typically live.
Source code in src/plugins/dictation.py
insert_text
¶
Insert text via AT-SPI.
Returns one of INSERTED, NO_FOCUS or BACKEND_ERROR so the caller can give feedback that matches the real cause instead of always blaming focus.
Source code in src/plugins/dictation.py
format_text
¶
Convert spoken punctuation to actual punctuation.
Source code in src/plugins/dictation.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
run_push_to_talk
¶
Dictate while the activation keys are held (the silent-activation path).
Mirrors the voice notes loop but is gated on should_continue — a predicate that
is True while the keys remain held — instead of a spoken "stop notes": each
utterance captured from core is formatted and inserted until the keys are
released. The capture waits re-check should_continue so releasing stops dictation
promptly.
Source code in src/plugins/dictation.py
handle
¶
Enter dictation mode on a whole-word "note"/"notes"; return None otherwise.
Matching whole words (not substrings) keeps unrelated words like "notebook" or "noted" from triggering it. While in dictation mode it loops, transcribing speech and inserting it into the focused field until "stop notes" is heard.
Source code in src/plugins/dictation.py
mousegrid (00_mousegrid)¶
plugins.00_mousegrid
¶
Mouse Grid Plugin - Voice-controlled mouse via GNOME Shell D-Bus extension.
Features: - Chained numbers: "3 7 5" zooms three times in one utterance - Repetition: "nudge up 5", "scroll down 3" - Drag support: "mark" to start, "drag" to end
setup
¶
host_run
¶
Run a command and capture its output (the plugin's own subprocess seam).
A missing executable returns a failed result (returncode 1) rather than
raising, so callers treat an absent gdbus—e.g. on a headless host such as
WSL with no GNOME session—as a plain D-Bus failure. Without this the atexit
cleanup would raise FileNotFoundError on exit.
Source code in src/plugins/00_mousegrid.py
dbus_call
¶
Call a method on the grid extension over D-Bus; True on success.
Source code in src/plugins/00_mousegrid.py
get_screen_size
¶
Get screen size from GNOME Shell extension (accurate for Wayland).
Source code in src/plugins/00_mousegrid.py
cleanup
¶
parse_number_sequence
¶
Extract ALL numbers from text as a sequence.
'3 7 5' -> [3, 7, 5].
Source code in src/plugins/00_mousegrid.py
parse_count
¶
Extract a repeat count (for nudge/scroll).
Returns single number or 1.
Source code in src/plugins/00_mousegrid.py
parse_direction
¶
Return the direction (up/down/left/right) named in text, or None.
get_center
¶
Return the (x, y) center of the current grid cell, or None if no grid.
show_grid
¶
Show the full-screen grid overlay (no-op if it is already active).
Source code in src/plugins/00_mousegrid.py
close_grid
¶
update_grid
¶
Zoom to a single zone.
Returns True if successful.
Source code in src/plugins/00_mousegrid.py
process_zones
¶
do_click
¶
Click at the current cell center and close the grid; False if no grid.
Source code in src/plugins/00_mousegrid.py
do_scroll
¶
Scroll count steps at the current cell center; False if no grid.
Source code in src/plugins/00_mousegrid.py
nudge_grid
¶
Shift the current cell count steps in a direction; False if no grid.
Source code in src/plugins/00_mousegrid.py
start_drag
¶
Press at the current cell center and reset the grid to full screen.
Leaves a drag in progress so a later end_drag
releases at the new target. False if no grid is active.
Source code in src/plugins/00_mousegrid.py
end_drag
¶
Release a drag and close the grid.
Releases a drag started by start_drag.
False if no drag is in progress or no grid is active.
Source code in src/plugins/00_mousegrid.py
handle
¶
Show or reopen the grid on a trigger word, then enter grid mode.
Returns None for commands that don't open the grid.
Source code in src/plugins/00_mousegrid.py
listen_for_grid_commands
¶
Continuous listening while grid active.
Source code in src/plugins/00_mousegrid.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | |
headtrack (00_eyetrack)¶
plugins.00_eyetrack
¶
Head Tracking Plugin - Cursor control via SixDRepNet.
Uses a 6D rotation representation for smooth head pose estimation.
OneEuroFilter
¶
One-Euro filter for smoothing noisy signals.
Adaptive: smooth when the signal is still, responsive when it moves.
Initialise the filter's cutoff/responsiveness parameters.
Source code in src/plugins/00_eyetrack.py
__call__
¶
Filter the next sample x and return the smoothed value.
Source code in src/plugins/00_eyetrack.py
setup
¶
host_run
¶
dbus_call
¶
Call GNOME Shell extension for cursor movement.
Source code in src/plugins/00_eyetrack.py
get_screen_size
¶
Get screen size from GNOME Shell extension.
Source code in src/plugins/00_eyetrack.py
run_tracking
¶
Main tracking loop.
Source code in src/plugins/00_eyetrack.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
start_tracking
¶
Start the head-tracking thread; returns (started, message).
Source code in src/plugins/00_eyetrack.py
stop_tracking
¶
Signal the tracking thread to stop; returns (stopped, message).
recalibrate
¶
Reset calibration - will auto-calibrate on next frames.
Source code in src/plugins/00_eyetrack.py
handle
¶
Start/stop tracking or run a tracking command; None if not head-tracking.
Source code in src/plugins/00_eyetrack.py
listen_for_tracking_commands
¶
Continuous listening while tracking active.
Source code in src/plugins/00_eyetrack.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | |