Skip to main content

A WakaTime plugin wrapper for GNU Nano

Project description

Nano WakaTime Plugin ⏱️

A lightweight, cross-platform Python wrapper that adds WakaTime tracking to the GNU Nano editor.

Nano WakaTime Language Status

Unlike modern IDEs (VS Code, JetBrains), nano does not support native plugins. This tool solves that by using the Wrapper Pattern. It launches a background file watcher alongside the editor to detect "Save" events and sync them to the WakaTime API silently.


🏗️ Architecture

How it works under the hood:

sequenceDiagram
    participant User
    participant NanoW as nanow (Wrapper)
    participant Editor as GNU Nano
    participant Watcher as Watchdog (Thread)
    participant CLI as WakaTime CLI
    
    User->>NanoW: run "nano file.py"
    NanoW->>Watcher: Start background monitoring on file.py
    NanoW->>Editor: Launch Editor (Foreground)
    
    loop Editing Session
        User->>Editor: Edit & Save (Ctrl+O)
        Editor-->>Watcher: File System Event (MODIFY)
        Watcher->>CLI: Trigger heartbeat
        CLI-->>WakaTime API: HTTP POST (201 Created)
    end
    
    User->>Editor: Exit (Ctrl+X)
    Editor->>NanoW: Process Ends
    NanoW->>Watcher: Stop & Cleanup

✨ Features

  • Zero Latency: The editor runs natively; the tracking happens in a non-blocking background thread.
  • Atomic Save Detection: Uses watchdog to handle complex file system events (more robust than polling).
  • Smart Argument Parsing: Distinguishes between Nano flags (e.g., -w, -c) and actual filenames.
  • Cross-Platform: Works on Linux and macOS.

📦 Dependencies

  • Python 3.6+
  • WakaTime CLI (Standard Go binary)
  • Python Watchdog Library

1. Install Python Watchdog

pip3 install -r requirements.txt

2. Install WakaTime CLI (if not already installed)

curl -fsSL https://raw.githubusercontent.com/wakatime/vim-wakatime/master/install_cli.py | python3

🚀 Installation

1. Download the Wrapper

Clone this repository or download the script directly.

git clone https://github.com/YOUR_USERNAME/nano-wakatime.git
cd nano-wakatime

2. Install

Move the script to your local binary folder and make it executable.

mkdir -p ~/.local/bin
cp nanow.py ~/.local/bin/nanow
chmod +x ~/.local/bin/nanow

3. Create the Alias

To make this seamless, alias nano to use this wrapper. Add this to your .bashrc or .zshrc:

alias nano="nanow"

Reload your shell:

source ~/.bashrc

⚙️ Configuration

Create your WakaTime config file if you haven't already.

  1. Get your API Key from wakatime.com/api-key.
  2. Create the config file:
# Note: Use \nano to bypass the alias for initial setup
\nano ~/.wakatime.cfg
  1. Paste the following:
[settings]
api_key = your_secret_api_key_here

🕹️ Usage

Just use nano as you normally would!

# The wrapper automatically starts
nano my_script.py

# Works with flags too
nano -c -w my_script.py

Note: Time is tracked when you Save (Ctrl+O).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nano_wakatime-1.0.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nano_wakatime-1.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file nano_wakatime-1.0.0.tar.gz.

File metadata

  • Download URL: nano_wakatime-1.0.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for nano_wakatime-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c150f29cd9a8530badc356e228bf30ce45df2a9174190f14bdc58c1b33f174b3
MD5 95ba76332f2168ab52353aef63941b62
BLAKE2b-256 1aeda5ea9b3bccbeea91640b7c0bd48a9d141208f2d50bd58cca8848d7520800

See more details on using hashes here.

File details

Details for the file nano_wakatime-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nano_wakatime-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for nano_wakatime-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 581bae96ed5bdab7e56793ebfffc7cb0850f4e7efe231aed6d7d9755fc204011
MD5 e518770dd73a31be027eec4a86375278
BLAKE2b-256 ebde4a4583503e3375ddf419e36b0fa027afcd569c77a67e9e7e7ef47825b024

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page