Metadata-Version: 2.4
Name: hermes-font-scale
Version: 0.1.5
Summary: Unofficial community helper — make Hermes Desktop GUI font bigger in one command.
Author: LUKE
License: MIT
Project-URL: Homepage, https://github.com/hsukevin0407-crypto/hermes-font-scale
Project-URL: Issues, https://github.com/hsukevin0407-crypto/hermes-font-scale/issues
Keywords: hermes-agent,cli,accessibility,font-size,electron
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# hermes-font-scale

> Unofficial community helper — patch **Hermes Desktop** GUI font size in one command, atomically and reversibly.
> NOT affiliated with [NousResearch/hermes-agent](https://github.com/NousResearch/hermes-agent).

[![Tests](https://img.shields.io/github/actions/workflow/status/hsukevin0407-crypto/hermes-font-scale/test.yml?branch=main&label=tests)](https://github.com/hsukevin0407-crypto/hermes-font-scale/actions/workflows/test.yml)
[![PyPI version](https://img.shields.io/pypi/v/hermes-font-scale)](https://pypi.org/project/hermes-font-scale/)
[![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue)](https://pypi.org/project/hermes-font-scale/)
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)

[English](#english) | [中文](#中文)

---

## English

### The Problem

Hermes Desktop hard-codes its base font size at 14 px inside a CSS file. There is no GUI setting to change it. On high-DPI or 4K displays, 14 px is too small to read comfortably.

### What This Tool Does

`hermes-font-scale` rewrites the one CSS line that controls the font size — atomically, reversibly, with a backup — so you can set any size from 10 to 32 px.

```
Before: font-size: clamp(14px, calc(14px + 2 * ((100vw - 1400px) / 400)), 18px)
After:  font-size: clamp(18px, calc(18px + 2 * ((100vw - 1400px) / 400)), 22px)
```

### Requirements

- Python 3.9 or later
- Hermes Desktop installed

### Installation

```bash
pip install hermes-font-scale
```

### Quick Start

```bash
# 1. Check current state and locate globals.css
hermes-font-scale status

# 2. Set font size (10–32 px)
hermes-font-scale set 18

# 3. Restart Hermes Desktop to see the change
```

### All Commands

| Command | Description |
|---------|-------------|
| `hermes-font-scale set <PX>` | Set base font size (10–32 px) |
| `hermes-font-scale set <PX> --dry-run` | Preview the change without writing |
| `hermes-font-scale reset` | Restore original CSS from `.bak` |
| `hermes-font-scale status` | Show current patch state |
| `hermes-font-scale status --json` | Same, in JSON format |
| `hermes-font-scale doctor` | Run 4 diagnostic checks |

### Environment Variables

| Variable | Description |
|----------|-------------|
| `HERMES_HOME` | Override Hermes install root path |

```bash
# Example: non-standard install location
HERMES_HOME=/opt/my-hermes hermes-font-scale set 18
```

### How It Works

```
hermes-font-scale set 18
        │
        ├─ 1. Locate globals.css (HERMES_HOME → env var → OS search paths)
        ├─ 2. Validate font size is in range [10, 32]
        ├─ 3. Create globals.css.bak (first run only)
        ├─ 4. Write to globals.css.tmp
        └─ 5. os.replace(tmp → globals.css)  ← atomic, crash-safe
```

Only the `font-size: clamp(...)` line is touched. Nothing else in the CSS is modified.

### Supported Install Paths

The tool automatically searches these locations:

**Windows**
- `%LOCALAPPDATA%\hermes\`
- `C:\Program Files\Hermes\`

**macOS**
- `/Applications/Hermes.app/Contents/Resources/`
- `~/Applications/Hermes.app/Contents/Resources/`

**Linux**
- `~/.local/share/hermes/`
- `/opt/hermes/`
- `/usr/local/share/hermes/`

Set `HERMES_HOME` if your install is elsewhere.

### Troubleshooting

**`hermes-font-scale doctor` shows "font-size clause present: FAIL"**

The CSS file may be inside an `.asar` archive (common with some Hermes installer versions). Run:

```bash
hermes-font-scale doctor
```

and check the "CSS file exists" line. If the path ends in `app.asar` (not `app.asar.unpacked`), see [Issue #1](https://github.com/hsukevin0407-crypto/hermes-font-scale/issues) for workarounds.

**Font size reverted after Hermes update**

Hermes updates overwrite `node_modules`. Re-run `hermes-font-scale set <PX>` after updating.

**Permission denied on Linux**

If Hermes is installed system-wide:

```bash
sudo hermes-font-scale set 18
```

### Uninstall

```bash
# Restore original CSS first
hermes-font-scale reset

# Then uninstall the tool
pip uninstall hermes-font-scale
```

### Contributing

```bash
git clone https://github.com/hsukevin0407-crypto/hermes-font-scale.git
cd hermes-font-scale
pip install -e ".[dev]"
pytest
ruff check src tests
```

CI runs Python 3.9–3.12 on Ubuntu, Windows, and macOS.

---

## 中文

### 問題說明

Hermes Desktop 把基礎字體大小寫死在一個 CSS 檔案裡，預設 14px，沒有任何設定介面可以調整。在高 DPI 或 4K 螢幕上，14px 的字體太小，很難閱讀。

### 這個工具做什麼

`hermes-font-scale` 會修改控制字體大小的那一行 CSS，操作是原子性的（crash-safe）、可還原的（自動備份），支援設定 10 到 32px 的任意大小。

### 需求

- Python 3.9 以上
- 已安裝 Hermes Desktop

### 安裝

```bash
pip install hermes-font-scale
```

### 快速開始

```bash
# 1. 確認目前狀態並找到 globals.css
hermes-font-scale status

# 2. 設定字體大小（10–32 px）
hermes-font-scale set 18

# 3. 重新啟動 Hermes Desktop 即可看到變化
```

### 所有指令

| 指令 | 說明 |
|------|------|
| `hermes-font-scale set <PX>` | 設定字體大小（10–32 px） |
| `hermes-font-scale set <PX> --dry-run` | 預覽變更，不實際寫入 |
| `hermes-font-scale reset` | 從備份還原原始 CSS |
| `hermes-font-scale status` | 顯示目前 patch 狀態 |
| `hermes-font-scale status --json` | 同上，輸出 JSON 格式 |
| `hermes-font-scale doctor` | 執行 4 項診斷檢查 |

### 環境變數

| 變數 | 說明 |
|------|------|
| `HERMES_HOME` | 覆蓋 Hermes 安裝根目錄路徑 |

```bash
# 範例：非標準安裝位置
HERMES_HOME=/opt/my-hermes hermes-font-scale set 18
```

### 運作原理

```
hermes-font-scale set 18
        │
        ├─ 1. 定位 globals.css（HERMES_HOME → 環境變數 → OS 搜尋路徑）
        ├─ 2. 驗證字體大小在範圍內 [10, 32]
        ├─ 3. 建立 globals.css.bak（僅第一次執行）
        ├─ 4. 寫入 globals.css.tmp
        └─ 5. os.replace(tmp → globals.css)  ← 原子操作，crash-safe
```

只修改 `font-size: clamp(...)` 這一行，CSS 檔案其他內容完全不動。

### 疑難排解

**`doctor` 顯示「font-size clause present: FAIL」**

CSS 檔可能在 `.asar` 壓縮檔內（部分 Hermes 安裝版本）。執行：

```bash
hermes-font-scale doctor
```

確認「CSS file exists」那行的路徑。若路徑結尾是 `app.asar`（而不是 `app.asar.unpacked`），請參考 [Issue #1](https://github.com/hsukevin0407-crypto/hermes-font-scale/issues)。

**Hermes 更新後字體大小被重置**

Hermes 更新時會覆蓋 `node_modules`。更新後重新執行 `hermes-font-scale set <PX>` 即可。

**Linux 上出現權限錯誤**

若 Hermes 安裝在系統目錄：

```bash
sudo hermes-font-scale set 18
```

### 解除安裝

```bash
# 先還原原始 CSS
hermes-font-scale reset

# 再移除工具
pip uninstall hermes-font-scale
```

---

## Disclaimer

Unofficial community project. Not affiliated with or endorsed by Nous Research. Patching application files carries inherent risk — always keep a backup. Use at your own risk.
