Skip to content

feat: add WatchContextInput for monitoring custom commands#353

Open
iberianpig wants to merge 3 commits intomainfrom
tail-context
Open

feat: add WatchContextInput for monitoring custom commands#353
iberianpig wants to merge 3 commits intomainfrom
tail-context

Conversation

@iberianpig
Copy link
Copy Markdown
Owner

@iberianpig iberianpig commented Jan 31, 2026

Summary

  • Add WatchContextInput plugin to monitor user-defined commands and output their results as context events
  • Executes commands periodically and emits events only when values change
  • Use Open3.capture3 for safer command execution with stderr logging
  • Use plugin: inputs: watch_context_input: config key (consistent with other plugins)

Configuration Example

plugin:
  inputs:
    watch_context_input:
      window:
        command: "xdotool getactivewindow getwindowname"
        interval: 0.5
      battery:
        command: "cat /sys/class/power_supply/BAT0/capacity"
        interval: 30

Test plan

  • Run bundle exec rspec to verify all tests pass (293 examples, 0 failures)
  • Verify RBS type definitions with bundle exec steep check

🤖 Generated with Claude Code

iberianpig and others added 2 commits February 1, 2026 02:34
Add TailContextInput, TailContextDetector, and TailContextBuffer plugins
to monitor user-defined commands and output their results as context events.
This enables context-aware gesture configurations based on external command output.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…nput

- Add warning log when tail_context command fails with exit status
- Change empty config behavior from break to sleep+continue for hot-reload support
- Update RBS type definitions for detector and tail_context_input
- Add tests for error logging and empty config loop behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@iberianpig iberianpig changed the title feat: add TailContextInput for monitoring custom commands feat: add WatchContextInput for monitoring custom commands Feb 5, 2026
- Rename tail_context -> watch_context (classes, config key, files)
- Add streaming mode support: when no interval specified, use IO.popen
  for continuous command output monitoring
- Polling mode (with interval) executes command periodically
- Streaming mode (without interval) reads continuously from command

Config example:
```yaml
watch_context:
  battery:
    command: "cat /sys/class/power_supply/BAT0/capacity"
    interval: 30  # polling mode
  events:
    command: "some-streaming-cmd"  # streaming mode (no interval)
```

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant