View on GitHub

cat-window-watcher

cat-window-watcher

cat-window-watcher - Cat is watching you -

アクティブなウィンドウを監視し、あなたの作業内容に基づいてスコアを調整するシンプルでスタンドアロンなウィンドウ監視ツール。

Japanese English

WIP

開発中です。不具合があります。issueを参照ください

⚠️ 暫定実装についての注意

これはテストと検証のための暫定実装です。現在の実装は以下に焦点を当てています:

将来のバージョンでは最適化や統合が含まれる可能性がありますが、このバージョンはシンプルさと理解しやすさを優先しています。

コンセプト

アプリケーションは現在アクティブなウィンドウを監視し、設定可能なパターンに基づいてスコアを調整します:

The cat is watching you!

機能

見た目

╔════════════════════════════════════════════════════════════╗
║   Cat Window Watcher - Cat is watching you -               ║
╠════════════════════════════════════════════════════════════╣
║                                                            ║
║                                                            ║
║                       Score: 42                            ║
║                                                            ║
║                                                            ║
║                      GitHub (+10)                          ║
║                                                            ║
╚════════════════════════════════════════════════════════════╝

GUIはダークテーマで、大きなスコア表示と現在のアクティビティを表示するステータスを備えています。

インストール

  1. リポジトリをクローン:
    git clone https://github.com/cat2151/cat-window-watcher.git
    cd cat-window-watcher
    
  2. Python 3.12以上がインストールされていることを確認:
    python --version
    
  3. 依存関係をインストール(必要に応じて):
    • Linux: xdotool または xprop(通常はプリインストール済み)
    • macOS: 内蔵AppleScriptサポート
    • Windows: 内蔵APIで動作(より良いサポートのために pywin32 をオプションで使用)

設定

  1. 設定例をコピー:
    cp config.toml.example config.toml
    
  2. config.tomlを編集してウィンドウパターンとスコアをカスタマイズ:
# デフォルトスコア(パターンがマッチしない場合に適用)
# 設定ミスを検知しやすくするために使用します
# -1(デフォルト)で設定ミスを簡単に検知、0に設定で無効化
default_score = -1

[[window_patterns]]
regex = "github"           # Regex pattern to match window title
score = 10                 # Score change when this window is active
description = "GitHub"     # Display description

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

設定オプション

使用法

アプリケーションを実行:

# 方法1: スクリプトを直接実行
python src/main.py

# 方法2: モジュールとして実行
python -m src

# 方法3: カスタム設定ファイルで実行
python src/main.py --config my_config.toml
python src/main.py -c my_config.toml

GUIには以下が表示されます:

例1: 生産性の追跡

[[window_patterns]]
regex = "github|gitlab"
score = 10
description = "コーディング"

[[window_patterns]]
regex = "twitter|facebook|instagram"
score = -5
description = "ソーシャルメディア"

例2: 勉強時間

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

[[window_patterns]]
regex = "youtube|netflix"
score = -10
description = "エンターテイメント"

開発

テストの実行

python -m unittest discover tests/ -v

コードフォーマット

コミット前にコードをフォーマット:

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

リンティング

コード品質の検証:

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

アーキテクチャ

アプリケーションはいくつかのモジュールから構成されています:

プラットフォーム固有の注意事項

Linux

xdotool または xprop が必要:

sudo apt-get install xdotool  # Debian/Ubuntu

macOS

内蔵AppleScriptを使用。追加の依存関係は不要。

Windows

内蔵Windows APIで動作。より良い互換性のためにインストール:

pip install pywin32

ライセンス

詳細はLICENSEファイルをご覧ください。

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