taskwarrior-tui

repository·main·Indexed 24 days ago

https://github.com/kdheepak/taskwarrior-tui

A Terminal User Interface (TUI) for the Taskwarrior task management system, featuring vim-like navigation, live filtering, and task manipulation. It integrates with the Taskwarrior .taskrc file for configuration, colors, and display columns, and supports custom behavior via User Defined Attributes (UDAs) for keybindings, shortcuts, and UI styles.

Tokens
20.4K
Snippets
57
Records
118
Agent score
84%

What's inside taskwarrior-tui

  1. How the taskwarrior-tui architecture works

    main

    taskwarrior-tui is a state-driven terminal user interface built with ratatui.

    Core Logic Flow:

    1. Input: Keyboard events are read asynchronously and communicated via channels.
    2. State Management: Most application logic resides in src/app.rs. Key press actions are handled by app.handle_input(&mut self, input: Key).
    3. Rendering: The TUI renders the difference between the previous state and the current state every Tick. UI rendering is performed by various app.draw_... functions.
  2. Configure taskwarrior-tui using .taskrc

    main

    taskwarrior-tui derives its configuration from your existing Taskwarrior .taskrc file. It uses specific Taskwarrior settings to determine how tasks are displayed and colored.

    Taskwarrior Configuration Integration

    • Colors: taskwarrior-tui reads color attributes from Taskwarrior settings (e.g., color.tagged) to match the CLI appearance.
    • Display Columns: It reads report.next.labels and report.next.columns to determine which task attributes to display in the TUI.

    taskwarrior-tui Specific Configuration

    You can add custom uda.taskwarrior-tui.* keys to your .taskrc to control TUI-specific behavior, such as keybindings, shortcuts, and report styles.

    ### taskwarrior configuration options
    color.tagged=black on rgb444
    report.next.labels=ID,Active,Age,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg
    report.next.columns=id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description.truncated_count,urgency
    
    ### taskwarrior-tui configuration options
    uda.taskwarrior-tui.keyconfig.done=x
    uda.taskwarrior-tui.keyconfig.delete=d
    uda.taskwarrior-tui.task-report.use-alternate-style=false
    uda.taskwarrior-tui.shortcuts.1=~/local/bin/task-sync.sh
    uda.taskwarrior-tui.report.next.filter=(status:pending or status:waiting)
  3. Getting started with taskwarrior-tui

    main

    To begin using taskwarrior-tui, follow this recommended workflow:

    1. Installation: Set up the application using your preferred package manager.
    2. Quick Start: Follow the first-run workflow to get your environment ready.
    3. Default Keybindings: Familiarize yourself with the built-in keyboard-first controls.

    For more complex setups, you can explore Advanced Configuration for style and behavior options, or consult the Troubleshooting guide if you encounter issues with logs, timing, or path isolation.

  4. Build and preview documentation

    main

    The documentation site is built using Starlight/Astro and lives in the docs/ directory.

    • Build the docs site locally:
      mise run taskwarrior-tui:docs-build
    
    - **Start a local preview server** (for iterative work):
      ```bash
    mise run taskwarrior-tui:docs-preview
    • Regenerate the man page:
      mise run taskwarrior-tui:man
    mise run taskwarrior-tui:docs-build
    mise run taskwarrior-tui:docs-preview
    mise run taskwarrior-tui:man
  5. Install the development toolchain using `mise`

    main

    This project uses mise to manage its toolchain and environment. Follow these steps to install and activate it:

    1. Install mise:

      curl https://mise.run | sh
    2. Activate mise in your shell:

      • zsh:
        echo 'eval "$(mise activate zsh)"' >> "${ZDOTDIR-$HOME}/.zshrc"
      • bash:
        echo 'eval "$(mise activate bash)"' >> ~/.bashrc
      • fish:
        echo 'mise activate fish | source' >> ~/.config/fish/config.fish
    3. Install project tools: Restart your shell, then run:

      mise install

    Once activated, mise automatically handles pinned values (like Taskwarrior source tags and testdata refs) defined in .config/mise.toml.

    curl https://mise.run | sh
  6. Configure User-Defined Shortcuts

    main

    You can map keys 1-9 to custom executable scripts by defining them in your taskrc using uda.taskwarrior-tui.shortcuts.N (where N is 1-9).

    When a shortcut is triggered, the script is executed with the selected_tasks_uuid passed as the first argument.

    Steps to implement:

    1. Create a script (e.g., ~/.config/taskwarrior-tui/shortcut-scripts/my-script.sh).
    2. Ensure the script is executable: chmod +x /path/to/script.
    3. Add a shebang to the script (e.g., #!/usr/bin/env bash).
    4. Reference the script in taskrc.
    5. (Optional) Remap the shortcut key using uda.taskwarrior-tui.keyconfig.shortcut1=<key>.
    uda.taskwarrior-tui.shortcuts.1=~/.config/taskwarrior-tui/shortcut-scripts/add-personal-tag.sh
    
    # Example script content:
    task rc.bulk=0 rc.confirmation=off rc.dependency.confirmation=off rc.recurrence.confirmation=off "$@" modify +personal