View on GitHub

cat-window-watcher

cat-window-watcher

cat-window-watcher - Cat is watching you -

A simple, standalone window monitoring tool that watches your active window and adjusts your score based on your activity.

Japanese English

WIP

Currently under development. There are known bugs. Please refer to the issues.

⚠️ Note on Temporary Implementation

This is a temporary implementation for testing and validation purposes. The current implementation focuses on:

Future versions may include optimizations and integrations, but this version prioritizes simplicity and ease of understanding.

Concept

The application monitors your currently active window and adjusts a score based on configurable patterns:

The cat is watching you!

Features

Look and Feel

╔════════════════════════════════════════════════════════════╗
β•‘   Cat Window Watcher - Cat is watching you -               β•‘
╠════════════════════════════════════════════════════════════╣
β•‘                                                            β•‘
β•‘                                                            β•‘
β•‘                       Score: 42                            β•‘
β•‘                                                            β•‘
β•‘                                                            β•‘
β•‘                      GitHub (+10)                          β•‘
β•‘                                                            β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

The GUI features a dark theme with a large score display and status indicating the current activity.

Installation

  1. Clone the repository:
    git clone https://github.com/cat2151/cat-window-watcher.git
    cd cat-window-watcher
    
  2. Ensure Python 3.12 or higher is installed:
    python --version
    
  3. Install dependencies (if needed):
    • Linux: xdotool or xprop (usually pre-installed)
    • macOS: Built-in AppleScript support
    • Windows: Works with built-in APIs (optional pywin32 for better support)

Configuration

  1. Copy the example configuration:
    cp config.toml.example config.toml
    
  2. Edit config.toml to customize window patterns and scores:
# Default score (applied when no pattern matches)
# Used to easily detect misconfigurations
# -1 (default) for easy detection of misconfigurations, set to 0 to disable
default_score = -1

[[window_patterns]]
description = "GitHub"
regex = "github"
score = 10

[[window_patterns]]
description = "Twitter/X"
regex = "twitter|x\\.com"
score = -5

Configuration Options

Global Configuration Options

The following options are defined at the top-level of config.toml (outside [[window_patterns]]):

Window Pattern Specific Options

The following options are defined within the [[window_patterns]] section:

Usage

Run the application:

# Method 1: Run the script directly
python src/main.py

# Method 2: Run as a module
python -m src

# Method 3: Run with a custom configuration file
python src/main.py --config my_config.toml
python src/main.py -c my_config.toml

The GUI will display:

Examples

For more detailed configuration examples, refer to the examples/ directory.

Example 1: Productivity Tracking

Refer to examples/example1_productivity.ja.toml

[[window_patterns]]
description = "Coding"
regex = "github|gitlab"
score = 10

[[window_patterns]]
description = "Social Media"
regex = "twitter|facebook|instagram"
score = -5

Example 2: Study Time

Refer to examples/example2_study_time.ja.toml

[[window_patterns]]
description = "Reading"
regex = "pdf|documentation|docs"
score = 8

[[window_patterns]]
description = "Entertainment"
regex = "youtube|netflix"
score = -10

Example 3: Always-on-top mode with automatic move to back on mouse proximity

Refer to examples/example3_always_on_top.ja.toml

# Keep the window always on top, but automatically move to the back when the mouse approaches
always_on_top = true
hide_on_mouse_proximity = true
proximity_distance = 50

[[window_patterns]]
description = "GitHub"
regex = "github"
score = 10

With this configuration, the window will normally remain on top, but will automatically move to the back when the mouse cursor comes within 50 pixels, and return to the front when the mouse moves away. This is designed to avoid disrupting your work.

Development

Running Tests

python -m unittest discover tests/ -v

Code Formatting

Format code before committing:

ruff format src/ tests/
ruff check --fix src/ tests/

Linting

Validate code quality:

ruff format --check src/ tests/
ruff check src/ tests/

Architecture

The application is composed of several modules:

Platform-Specific Notes

Linux

Requires xdotool or xprop:

sudo apt-get install xdotool  # Debian/Ubuntu

macOS

Uses built-in AppleScript. No additional dependencies required.

Windows

Works with built-in Windows APIs. Install for better compatibility:

pip install pywin32

License

See the LICENSE file for details.

Big Brother is watching you. But this time, it’s a cat. 🐱