Skip to content

fix(icon): chọn màu icon khay theo panel của KDE Plasma (#374) - #497

Merged
nhktmdzhg merged 3 commits into
LotusInputMethod:devfrom
nguyenphivn:fix/plasma-panel-icon-374
Sep 15, 2026
Merged

nhktmdzhg merged 3 commits into
LotusInputMethod:devfrom
nguyenphivn:fix/plasma-panel-icon-374

Conversation

@nguyenphivn

Copy link
Copy Markdown
Contributor

Mô tả

Sửa lỗi icon chế độ Auto chọn chữ V đen trên panel tối của KDE Plasma khi color scheme của ứng dụng là sáng nhưng Plasma Style là tối. Đây là giao diện mặc định của Fedora 44. Nguyên nhân và cách tiếp cận mình đã ghi ở #374.

  • src/lotus-plasma-theme.h, src/lotus-plasma-theme.cpp (mới): đọc plasmarc theo thứ tự đè của KConfig (có ~/.config/kdedefaults), lấy [Colors:Window] BackgroundNormal từ file colors của Plasma Style; theme không có file này thì lấy từ color scheme hệ thống. Ngưỡng qGray < 192 giống xdg-desktop-portal-kde. Chỉ đọc file, không popen.
  • LotusEngine::isDarkMode(): khi XDG_CURRENT_DESKTOPKDE thì hỏi màu panel trước; không đọc ra màu thì chạy tiếp các bước cũ, nên DE khác không đổi.
  • test/plasma-panel-theme.cpp (mới): test đơn vị 15 trường hợp, không cần fcitx5 hay màn hình.

Loại thay đổi

  • Tính năng mới
  • Sửa lỗi
  • Cải thiện hiệu năng
  • Cập nhật tài liệu
  • Cải tiến CI/CD

Liên kết issue

Fixes #374

Screenshot (cho UI changes)

Fedora 44 KDE Plasma Wayland, giao diện mặc định, màu icon Auto: trước khi sửa là V đen trên panel tối, sau khi sửa là V trắng.

Checklist

  • Nhánh đích là dev (KHÔNG phải main)
  • Đã chạy clang-format (tuân thủ .clang-format): clang-format 22.1.8, --dry-run trên các file đã sửa không báo gì
  • Đã kiểm tra ruff checkruff format (cho phần Python settings-gui): không áp dụng, PR không đụng Python
  • Build C++ thành công (cmake .. && make): gcc 16, -DBUILD_TESTING=ON, ctest 10/10
  • Test pass (cd bamboo/ && go test -race ./...)
  • Đã rebase với nhánh dev mới nhất
  • Các CI checks pass: chưa chạy, CI cần maintainer duyệt

🤖 Generated with Claude Code

https://claude.ai/code/session_01W39vFnx4ECponJC5MQ9Fiu

…InputMethod#374)

On KDE the settings portal reports the application colour scheme
(kdeglobals), but the tray sits on the panel, which the Plasma Style
paints. The default Fedora 44 look pairs BreezeLight with the
breeze-dark Plasma Style (stored in ~/.config/kdedefaults), so Auto
picked the black icon on a black panel.

When XDG_CURRENT_DESKTOP names KDE, read plasmarc through the KConfig
cascade, use the theme's own colors file when it ships one and the
system scheme otherwise, and apply the portal's qGray < 192 threshold.
Plain file reads, no subprocess; fall back to the old probes when no
colour is found.

Verified on Fedora 44 KDE Wayland: tray icon black before, white after.
New unit test plasma_panel_theme: 15 cases, 12 red on an empty stub as
declared beforehand, all green with the fix; ctest 10/10 on dev.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W39vFnx4ECponJC5MQ9Fiu
@nhktmdzhg
nhktmdzhg merged commit 79d5706 into LotusInputMethod:dev Sep 15, 2026
40 of 42 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Kanban Sep 15, 2026
nguyenphivn added a commit to nguyenphivn/LotusVibe that referenced this pull request Sep 16, 2026
The fix itself was merged upstream in LotusInputMethod#497 without its test. Build the test
against the upstream code: link lotus-utils.cpp for getEnv and pass an empty
string to isKdePlasmaSession, which now takes std::string. 12/12 with ctest.
nguyenphivn added a commit to nguyenphivn/LotusVibe that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants