Addon Categories

Observers & Watchers

Build background observers, listen to system events, and emit one-click time-entry suggestions.

Activity Observers & Watchers

Watchers (or Observers) are plugins that passively monitor the user's workflow, such as presence in voice channels, Git commits, files opened in IDEs, or idle periods.

A Watcher emits Smart Time-Entry Suggestions so users can record hours with one click, without typing them manually.


🎧 Common Use Cases

  • Meeting Monitor: Detect joining and leaving voice calls in Discord, Google Meet, or Slack, then suggest a time entry with the exact meeting duration.
  • Idle Detector: Listen to Mr. Tick's onIdleDetected event and suggest pausing the timer or allocating time away.
  • Git / IDE Monitor: Observe development branches and suggest time entries linked to the tickets worked on during the day.

💻 Practical Watcher Example

1. manifest.yaml

id: reunioes-watcher
name: Watcher de Reuniões
version: 1.0.0
description: Detecta chamadas e sugere apontamentos de reuniões
author: Sua Empresa <contato@empresa.com>
main: dist/index.js

2. src/index.ts

import type { IAddon, AddonContext } from '@mr-tick/sdk'

export default class ReunioesWatcherAddon implements IAddon {
  private context: AddonContext | null = null

  public activate(context: AddonContext): void {
    this.context = context

    // Registra as preferências de configuração no formato de abas/grupos
    context.contributions.settings.register([
      {
        id: 'general',
        label: 'Geral',
        groups: [
          {
            id: 'preferences',
            label: 'Preferências do Observador',
            fields: [
              {
                id: 'atividadePadrao',
                label: 'ID da Atividade de Reunião',
                type: 'text',
                description:
                  'Código da atividade padrão para reuniões no seu DataSource.',
              },
            ],
          },
        ],
      },
    ])

    // Escutando eventos do sistema nativo
    context.host.events.onSystemIdle?.((idleTimeSeconds) => {
      console.log(`[Watcher] Usuário inativo por ${idleTimeSeconds} segundos.`)
    })
  }

  public deactivate(): void {
    this.context = null
  }

  // Emite uma sugestão diretamente para a timeline de Time Entries
  public async emitirSugestaoDeApontamento(
    titulo: string,
    duracaoSegundos: number,
  ): Promise<void> {
    if (!this.context) return

    await this.context.core.timeEntries.createSuggestion({
      taskId: '',
      comments: `Reunião: ${titulo}`,
      timeSpentSeconds: duracaoSegundos,
      source: 'addon',
    })

    await this.context.host.notifications.success(
      `Sugestão gerada: ${Math.round(duracaoSegundos / 60)} min em "${titulo}"`,
      'Reuniões Watcher',
    )
  }
}

⚡ How the Interface Processes Suggestions

  1. A Watcher detects the end of a contextual activity and emits a notification or event.
  2. Mr. Tick displays a contextual suggestion card on the Time Entries screen.
  3. The user can click Accept to save the suggested time entry immediately or Dismiss.