Habix

Software Engineer · 2025 · Completed · 1 person · 3 min read

A high-performance Rust successor to Habify (Python), re-engineered for near-instant execution and integrated into the OS via keybindings and system notifications.

Overview

Habix is the evolution of my Python-based Habify project. While both are CLI tools, Habix leverages Rust's performance to enable a frictionless productivity loop. By mapping Habix to a system-wide keybinding, users can instantly trigger a Habitica sync that displays Dailies and To-Dos via `notify-send`, removing the need to even open a terminal window.

Problem

The original Python-based Habify suffered from high startup latency, making it feel 'sluggish' when triggered via hotkeys. Additionally, requiring the user to manually read terminal output broke their focus. I needed a solution that was fast enough to be reactive and integrated enough to stay out of the terminal.

Constraints

  • Must reduce execution time to sub-100ms for seamless hotkey integration
  • Requires native interaction with Linux notification daemons (notify-send)
  • Must maintain a zero-dependency binary for easy portability across environments
  • Needs to handle API authentication securely and persistently

Approach

Rewrote the core logic in Rust to eliminate the Python interpreter's overhead. I shifted the output model from a standard 'print' loop to a dual-mode system: a formatted CLI output for management and a concise notification-friendly string for the 'Run' command, allowing it to feed directly into system-level alerts.

Key Decisions

Rust Rewrite for Hotkey Responsiveness

Reasoning:

When a tool is triggered via a keybinding (e.g., Alt+n in my window manager), any delay over 200ms feels 'broken.' Rust's compiled nature ensures the Habitica API is reached and the response is parsed before the user even releases the keys.

Alternatives considered:
  • Keeping Python and using a persistent daemon (Overly complex for a simple CLI tool)
  • PyInstaller/Nuitka (Increases binary size without solving the fundamental startup lag)

Native Notification Integration

Reasoning:

By formatting output specifically for `notify-send`, Habix allows for 'glanceable' productivity. The user gets the information they need in a non-intrusive popup, preserving their active workspace.

Alternatives considered:
  • Standard Terminal Output (Requires switching focus to a terminal window)
  • Writing a custom GUI overlay (Too much bloat for a minimalist tool)

Tech Stack

  • Rust
  • Tokio (Async Runtime)
  • Reqwest (HTTP Client)
  • Serde (JSON Serialization)
  • libnotify / notify-send

Result & Impact

  • Significant improvement over Python
    Startup Speed
  • Native System Notifications
    Integration
  • Hotkey-triggered Sync
    Workflow

The project successfully moves Habitica from a 'destination' to a 'utility.' By eliminating the need to visit the website or even stay in the terminal, Habix creates a distraction-free environment where habits are tracked with a single keystroke.

Learnings

  • Performance isn't just about 'big data'; in CLI tools, it's about the 'feel' of human-computer interaction.
  • Integrating CLI tools with system hotkeys and notifications provides a UX that feels closer to a custom OS feature than an external app.
  • Rust’s strict handling of Option and Result types made managing the unpredictable nature of network requests much more resilient.

Additional Context

Habix is built on the philosophy that productivity tools should be invisible. While Habify (Python) proved the concept, Habix (Rust) perfects the execution.

The most significant workflow improvement is the keybinding integration. In a typical tiling window manager or Linux desktop, I can map a shortcut to habix run. Because Rust is so efficient, the notification appears almost instantly. This creates a “heads-up display” (HUD) for my life—I hit a key, see my pending tasks via notify-send, and get right back to work without my hands ever leaving the home row.

This architecture ensures that Habix remains blazingly fast, providing a modern productivity workflow with a footprint so small it’s practically negligible.

[ repository ]