fix: peak banner color, popup positioning, window icon, timedelta days #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/ui-polish"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
UI polish: 4 fixes
1. Peak banner background color (green → correct blue/amber)
The stylesheet used hex+alpha suffix (
#3b82f61a), which Qt's CSS parser doesn't support — it was falling back to a default green. Switched to properrgba()notation:rgba(245, 158, 11, 0.2)(amber tint)rgba(59, 130, 246, 0.15)(blue tint)2. Popup positioned near tray (was center-screen)
On Wayland, tray icon clicks arrive via D-Bus (StatusNotifierItem), not as mouse events. So
QCursor.pos()returns a stale position at screen center. Now usesself._tray.geometry()to get the actual tray icon position as the anchor, with a fallback to bottom-right corner if the geometry isn't available.3. Window icon in taskbar
UsagePanelandQApplicationnow both callsetWindowIcon(), so the taskbar shows the Z icon instead of a generic Wayland/Qt placeholder.4. Timedelta shows days
_format_timedeltanow extracts days: weekly reset shows as6d 16hinstead of160h. Drops zero-value components but always shows at least one unit.49 tests still passing.
🤖 Hermes automated review: no blocking issues found
Reviewed the full diff (1 file, +34/−13) for head
49cab160against basecca3c916. This is a clean, well-reasoned set of UI fixes. All four changes are correct:main.py:406,416): Thergba()values correctly correspond to the existing hex constants —rgba(245, 158, 11, 0.2)=COLOR_WARNING(#f59e0b) andrgba(59, 130, 246, 0.15)=COLOR_NORMAL(#3b82f6). Qt's CSS parser indeed doesn't support 8-digit hex+alpha, so this is the right fix.main.py:551-576): Usingself._tray.geometry()as the anchor is the correct API forQSystemTrayIcon. The fallback chain (tray geo → cursor → bottom-right of primary screen) is sound, andQPoint/QRectare properly imported (line 11). Screen-bounds clamping is preserved.main.py:212,660):_icon_for_stateexists (line 97); both calls are valid._format_timedelta(main.py:439-452): Traced edge cases —0s→"0m",1dexact→"1d",23h→"23h",1d 1h→"1d 1h". The "always shows at least one unit" guarantee holds (theor not partsguard). Correct.🟡 Minor (non-blocking)
main.py:406,416— rgba values are now magic numbers that duplicateCOLOR_WARNING/COLOR_NORMAL. If those hex constants change, the rgba literals won't track. A brief comment (e.g.# matches COLOR_WARNING) would help future maintainers. Not worth blocking — Qt stylesheets don't cleanly support interpolating constants intorgba().main.py:440— docstring examples are slightly imprecise:"""Format a timedelta as 'Xd Yh Zm' or 'Yh Zm' or 'Zm'."""lists three combined forms, but the code drops individual zero components, so"1d 1m"(hours=0 skipped) is also possible. Cosmetic only.✅ Verification
.forgejo/workflows/ci.yml) exists forpull_request, but no status/coverage comment has appeared yet for head49cab160(PR opened ~minutes ago). Ran locally:pytest -q→ 49 passed in 0.32s (.venvwith PySide6 deps already present). No regressions.Note: this is a PR conversation comment — not a formal Forgejo review approval (the MCP integration cannot create approval states or inline diff comments).
Automated daily review. I never merge PRs.