aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 99b4e74f0113202f01031ffba3b6d75177745e3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<div align="center">

<img src="./assets/logo.svg" alt="pomoru" width="40%">

A minimalist Pomodoro TUI with a task list, written in Rust.

![Rust](https://img.shields.io/badge/Rust-Language-orange?logo=rust)
![ratatui](https://img.shields.io/badge/ratatui-TUI-blue)
![Tokio](https://img.shields.io/badge/Tokio-Async_Runtime-green)
![AUR](https://img.shields.io/aur/version/pomoru?logo=arch-linux)
![License](https://img.shields.io/badge/License-MIT-blue)

</div>

## Features

### Timer

- Work, short break, and long break sessions
- Customizable durations
- Desktop notifications when sessions end
- Optional automatic session switching
- Manual session progression mode

### Tasks

- Add, edit, delete tasks
- Toggle completion
- Task list persists across runs

### Design

- Keyboard-only interaction
- Minimalist interface
- Dynamic theming via [Noctalia](https://noctalia.dev) (v5 matugen templates + legacy `colors.json`)
- Configuration saved locally

---

## Demo

![Demo](screenshots/demo2.gif)

---

## Keybindings

### Timer screen

| Key     | Action                             |
| ------- | ---------------------------------- |
| `space` | Start or pause timer               |
| `tab`   | Change session type (when paused)  |
| `a`     | Toggle automatic session switching |
| `e`     | Edit current session time          |
| `r`     | Reset timer                        |
| `t`     | Open task list                     |
| `q`     | Quit                               |

### Task screen

| Key         | Action               |
| ----------- | -------------------- |
| `i`         | Add new task         |
| `enter`     | Toggle task done     |
| `e`         | Edit selected task   |
| `d`         | Delete selected task |
| `j` / `↓`   | Move down            |
| `J`         | Move task down       |
| `k` / `↑`   | Move up              |
| `K`         | Move task up         |
| `t` / `esc` | Back to timer        |

---

## Configuration

`pomoru` saves its state automatically when you quit.

Config file location:

```text
~/.config/pomoru/config.toml
```

Saved data includes:

- Work and break durations
- Task list

Example:

```toml
work_time_mins = 25
short_break_mins = 5
long_break_mins = 15
auto_switch_sessions = true

[[tasks]]
title = "Read documentation"
is_done = false
```

---

## Status Export

Pomoru exports its current state to:

```text
~/.cache/pomoru/status.json
```

Example:

```json
{
  "text": "󰄉 Work 24:31",
  "tooltip": "Work",
  "class": "work"
}
```

This can be used by:

- Waybar
- Custom status bars
- Shell scripts
- Desktop widgets

---

### Waybar

The previously stated `status.json` can be used in Waybar as follows:

```json
"custom/pomoru": {
  "exec": "cat ~/.cache/pomoru/status.json",
  "return-type": "json",
  "interval": 1,
  "format": "{text}",
  "tooltip": true
}
```

---

## Theming

Pomoru picks up colors in this priority order:

| Priority | Source | When it applies |
|----------|--------|-----------------|
| 1 | `~/.cache/pomoru/colors.json` | Noctalia v5 user template (recommended) |
| 2 | `~/.config/noctalia/colors.json` | Legacy noctalia v4 format |
| 3 | Built-in defaults | Catppuccin Mocha palette |

### Noctalia v5 — wiring it up

Noctalia v5 uses its own template engine (matugen-compatible `{{colors.<role>.default.hex}}` tokens). When the wallpaper or palette changes, noctalia re-renders all configured templates automatically. Pomoru ships the template and config snippet needed to hook into this system.

**One-time setup:**

```bash
# 1. Copy the input template into noctalia's template directory
mkdir -p ~/.config/noctalia/templates
cp assets/noctalia/colors-template.json \
   ~/.config/noctalia/templates/pomoru-colors.json

# 2. Register the user template in noctalia's config
#    Either append to an existing templates.toml, or create it fresh:
cat assets/noctalia/templates.toml >> ~/.config/noctalia/templates.toml

# 3. Render immediately (no need to change wallpaper)
noctalia msg templates-apply
```

After step 3, `~/.cache/pomoru/colors.json` will exist and pomoru picks it
up on the next launch.

**What noctalia renders** (`assets/noctalia/colors-template.json`):

```json
{
  "primary":            "{{colors.primary.default.hex}}",
  "on_surface_variant": "{{colors.on_surface_variant.default.hex}}",
  "surface_container":  "{{colors.surface_container.default.hex}}",
  "on_surface":         "{{colors.on_surface.default.hex}}"
}
```

**The config block** (`assets/noctalia/templates.toml`) noctalia reads:

```toml
[theme.templates.user.pomoru]
input_path  = "$XDG_CONFIG_HOME/noctalia/templates/pomoru-colors.json"
output_path = "$XDG_CACHE_HOME/pomoru/colors.json"
```

> **Note:** `$XDG_CONFIG_HOME` defaults to `~/.config` and `$XDG_CACHE_HOME`
> defaults to `~/.cache`. Noctalia v5 expands these automatically.

> **Coming from noctalia v4?** Delete the stale files from `~/.config/noctalia/`:
> - `colors.json` — not read by v5
> - `user-templates.toml` — uses matugen's old `[templates.*]` schema; v5 will
>   warn `templates: unknown section` and ignore it. The v5 schema is
>   `[theme.templates.user.*]` in any `*.toml` under `~/.config/noctalia/`.

**Validate your config:**

```bash
noctalia config validate ~/.config/noctalia/templates.toml
# → ✓ Config is valid
```

**Re-apply without changing wallpaper:**

```bash
noctalia msg templates-apply
```

### Legacy noctalia (v4)

No setup required. If `~/.config/noctalia/colors.json` exists and
`~/.cache/pomoru/colors.json` does not, pomoru reads the legacy camelCase
format automatically. Delete it once you've set up the v5 template above.

---

## Installation

### Prebuilt binary

Download from the releases page:

https://github.com/RanXom/pomoru/releases

```bash
tar -xvf pomoru-1.0.0-x86_64.tar.gz
cd pomoru-1.0.0-x86_64
./pomoru
```

To install globally:

```bash
cd pomoru-1.0.0-x86_64
sudo cp pomoru /usr/local/bin/
pomoru
```

### Arch Linux (AUR)

```bash
yay -S pomoru        # build from source
yay -S pomoru-bin    # prebuilt binary
```

### Build from source

```bash
git clone https://github.com/RanXom/pomoru
cd pomoru
cargo run --release
```

To install the binary locally:

```bash
cargo install --path .
```

---

## Star History

<a href="https://www.star-history.com/?repos=ranxom%2Fpomoru&type=date&legend=top-left">
 <picture>
   <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=ranxom/pomoru&type=date&theme=dark&legend=top-left" />
   <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=ranxom/pomoru&type=date&legend=top-left" />
   <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=ranxom/pomoru&type=date&legend=top-left" />
 </picture>
</a>

---

## Built with

- Rust
- ratatui
- crossterm
- tokio
- notify-rust
- serde + toml

---

## License

MIT