Files
dotfiles/.memory/research/waybar-pomodoro-not-showing.md
alex wiesner cb208a73c4 changes
2026-03-13 13:28:20 +00:00

149 lines
7.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: waybar-pomodoro-not-showing
type: note
permalink: dotfiles/research/waybar-pomodoro-not-showing
tags:
- waybar
- pomodoro
- debugging
- risk
---
# Waybar Pomodoro Not Showing — Research Findings
## Scope
Investigation of why `custom/pomodoro` does not appear on the Waybar status bar.
Files inspected: `.config/waybar/config`, `.config/waybar/style.css`, `.config/waybar/scripts/pomodoro-preset.sh`.
## Module Wiring (as configured)
### modules-left (config line 59)
```json
"modules-left": [
"backlight",
"wireplumber",
"custom/pomodoro",
],
```
`custom/pomodoro` IS present in `modules-left`.
### custom/pomodoro definition (config lines 133140)
```json
"custom/pomodoro": {
"format": "{}",
"return-type": "json",
"exec": "waybar-module-pomodoro --no-work-icons",
"on-click": "waybar-module-pomodoro toggle",
"on-click-right": "$HOME/.config/waybar/scripts/pomodoro-preset.sh",
"on-click-middle": "waybar-module-pomodoro reset",
},
```
### CSS selector (style.css lines 106109)
```css
#custom-pomodoro {
padding: 0 4px;
color: @red;
}
```
Selector is correct and present.
### Script (scripts/pomodoro-preset.sh)
- Guarded by `command -v waybar-module-pomodoro` check (exits 1 if not installed).
- Sets work/short/long durations via `waybar-module-pomodoro set-*` subcommands.
- Toggle cycles between preset A (50/10/20) and preset B (25/5/15).
- **Script itself is logically correct.**
---
## Root Cause Analysis (ranked by confidence)
### 🔴 #1 — `waybar-module-pomodoro` binary not installed / not on PATH (confidence: ~90%)
- The `exec` command is `waybar-module-pomodoro --no-work-icons` — a **bare binary name**, resolved from PATH at Waybar launch time.
- Waybar inherits the environment of its launcher (Hyprland `exec-once`), which may NOT include the user's shell PATH (`~/.local/bin`, `/usr/local/bin`, etc.).
- `fish/config.fish` adds `/home/alex/dotfiles/.local/bin` to PATH, but that is only set in interactive Fish sessions — **Hyprland's exec-once does not source Fish config**.
- No package manager manifest, AUR package list, or install script mentions `waybar-module-pomodoro`.
- When `exec` fails to start, Waybar hides the module entirely (no fallback text) — the module disappears silently.
- **This is the most likely cause.** Verify with: `which waybar-module-pomodoro` in a non-Fish shell, or check `journalctl --user -u waybar` for "Failed to execute".
### 🟠 #2 — `interval` key absent on custom/pomodoro (confidence: ~65%)
- `custom/pomodoro` has NO `interval` key. For a persistent daemon (`waybar-module-pomodoro` runs and writes JSON to stdout continuously), this is correct — Waybar treats it as a long-lived subprocess.
- BUT if the binary is supposed to be polled (not a persistent daemon), missing `interval` means Waybar will only run it once and never refresh.
- The `return-type: json` combined with no `interval` means Waybar expects the binary to **continuously emit newline-delimited JSON** to stdout. If the binary only emits once and exits, the module will show blank after the first read.
- This is a secondary cause contingent on what `waybar-module-pomodoro` actually does. If it is a daemon that stays alive, #1 is the only blocker; if it exits after one line, `interval` is needed.
### 🟡 #3 — Binary exists but crashes on `--no-work-icons` flag (confidence: ~25%)
- The `--no-work-icons` flag may not be a valid flag for the installed version of `waybar-module-pomodoro`.
- An unrecognized flag causing the binary to exit with a non-zero code would suppress the module.
- Check: `waybar-module-pomodoro --help` or `waybar-module-pomodoro --no-work-icons` manually.
### 🟡 #4 — Config JSON parse failure (confidence: ~15%)
- The config uses tab-indented lines (lines 134139 use `\t`) while the rest uses spaces — mixed indentation is cosmetically inconsistent but does NOT cause JSON parse errors.
- Waybar's parser accepts JSON5/hjson (trailing commas, `//` comments) — both are used in this config and are fine.
- No structural JSON error was found in the config.
### ⚪ #5 — Hyprland not auto-starting Waybar at all (confidence: ~10%)
- If `exec-once=waybar` in `hyprland.conf` is missing or commented out, the bar won't show at all (not just the pomodoro module). Not specific to this module.
---
## Concrete Edit Points
### Fix #1 (most likely): Ensure binary is installed and PATH is set in Waybar launch environment
**Option A — Install the binary system-wide:**
Install `waybar-module-pomodoro` via your package manager (e.g. `paru -S waybar-module-pomodoro` on Arch) so it is in `/usr/bin` or `/usr/local/bin`, which is always in Waybar's inherited PATH.
**Option B — Use absolute path in config:**
```diff
- "exec": "waybar-module-pomodoro --no-work-icons",
- "on-click": "waybar-module-pomodoro toggle",
- "on-click-middle": "waybar-module-pomodoro reset",
+ "exec": "$HOME/.local/bin/waybar-module-pomodoro --no-work-icons",
+ "on-click": "$HOME/.local/bin/waybar-module-pomodoro toggle",
+ "on-click-middle": "$HOME/.local/bin/waybar-module-pomodoro reset",
```
File: `.config/waybar/config`, lines 136139.
**Option C — Set PATH in Hyprland env (preferred for Wayland):**
Add to `.config/hypr/hyprland.conf`:
```
env = PATH,$HOME/.local/bin:/usr/local/bin:/usr/bin:/bin
```
### Fix #2 (if binary is a one-shot, not a daemon): Add `interval` key
```diff
"custom/pomodoro": {
"format": "{}",
"return-type": "json",
+ "interval": 1,
"exec": "waybar-module-pomodoro --no-work-icons",
```
File: `.config/waybar/config`, line 134 (insert after `"return-type": "json",`).
---
## Files Involved
| File | Role |
|---|---|
| `.config/waybar/config` | Module registration in `modules-left`, `custom/pomodoro` definition |
| `.config/waybar/style.css` | `#custom-pomodoro` CSS selector (present, correct) |
| `.config/waybar/scripts/pomodoro-preset.sh` | Right-click preset toggler (calls binary) |
| `.config/hypr/hyprland.conf` | Waybar autostart + env block (outside Waybar dir) |
| `waybar-module-pomodoro` binary | External binary — must be installed and on PATH |
---
## Likely Bug Surfaces (Adjacent Risk Areas)
1. **`custom/uptime`** (config line 8995): Also uses a bare script path `$HOME/.config/waybar/scripts/uptime.sh`. Same PATH-at-launch issue could affect it if shell env is not inherited. The script exists in the repo (`scripts/` dir shows only `pomodoro-preset.sh`) — **`uptime.sh` is missing from the repo**, meaning this module may also be broken.
2. **`custom/music`** (config line 4452): Uses `playerctl` — same PATH issue; no `playerctl` install evidence in the repo.
3. **`hyprland/workspaces`** (config line 2228): Defined in config but NOT in any of `modules-left`, `modules-center`, or `modules-right` — it is **a dead definition that never renders**.
4. **`custom/lock`** (config line 127131): Defined but also absent from all three module lists — another dead definition.
5. **`network`** (config line 6068): Defined but not in any module list — dead definition.
6. **Trailing comma on line 8** of `modules-left`: Benign in Waybar's parser but would break standard JSON parsers if config is ever processed by tools expecting strict JSON.
## Relations
- related_to [[dotfiles/knowledge]]