Skip to content

[XFCE] Power manager (battery) icon does not display correctly on modern Linux systems (在现代 Linux 系统的 XFCE 环境下,电源管理器(电池)图标显示不正确) #220

@Kakokaler

Description

@Kakokaler

Issue 描述 (Description):
Hello, I've encountered a compatibility issue with this wonderful icon theme on modern Linux distributions using the XFCE desktop environment.
(您好,我在使用 XFCE 桌面环境的现代 Linux 发行版上,遇到了这个优秀图标主题的一个兼容性问题。)

  1. Problem Description (问题描述)
    On a fresh installation of Kali Linux (Debian-based) with XFCE, the battery icon in the xfce4-panel does not use the Windows-10-Icons theme. Instead, it falls back to the default Adwaita icon, except for a few specific states (e.g., 91-99% charging).
    (在一个全新的、使用 XFCE 的 Kali Linux 系统上,xfce4-panel 中的电池图标没有使用 Windows-10-Icons 主题。相反,它回退到了默认的 Adwaita 图标,只有在少数特定状态下(例如 91-99% 充电时)才显示正常。)

  2. System Environment (系统环境)
    OS: Kali Linux (Debian Rolling)
    Desktop Environment: XFCE 4.18 (or newer)
    Icon Theme: Windows-10-Icons (from this repository)

  3. Diagnostics & Root Cause (诊断过程与根本原因)
    After extensive troubleshooting, I've determined the root cause:
    The xfce4-power-manager-plugin on modern systems prioritizes loading symbolic icons with specific battery levels (e.g., battery-level-80-symbolic.svg, battery-level-80-charging-symbolic.svg).
    A comparison with a fully functional icon theme (like Adwaita) shows that the Windows-10-Icons theme is missing all of these specific-level symbolic icons. It only provides a few generic symbolic icons. This causes the icon lookup to fail for most battery states, forcing the system to fall back to the Inherits theme.
    (经过详尽的排错,我确定了根本原因:现代系统上的 xfce4-power-manager-plugin 会优先加载带有具体电量百分比的符号图标(例如 battery-level-80-symbolic.svg)。通过与功能完备的图标主题(如 Adwaita)对比发现,Windows-10-Icons 主题完全缺失了所有这些带有具体百分比的符号图标,它只提供了一些通用的符号图标。这导致在大多数电池状态下图标查找失败,迫使系统回退到 Inherits 指定的主题。)

Instructions:(操作说明:)
Open a terminal. (打开终端。)
Navigate to the icon theme's status directory. (切换到图标主题的 status 目录。)
Copy and paste the entire script block below and press Enter. (复制下方的整个脚本块,粘贴并按回车。)

# === START OF SCRIPT ===

# --- Create symbolic links for discharging states by mapping them to generic states ---
echo "--- Creating links for discharging states..."
sudo ln -sf battery-full-symbolic.svg battery-level-100-symbolic.svg
sudo ln -sf battery-full-symbolic.svg battery-level-90-symbolic.svg
sudo ln -sf battery-good-symbolic.svg battery-level-80-symbolic.svg
sudo ln -sf battery-good-symbolic.svg battery-level-70-symbolic.svg
sudo ln -sf battery-good-symbolic.svg battery-level-60-symbolic.svg
sudo ln -sf battery-good-symbolic.svg battery-level-50-symbolic.svg
sudo ln -sf battery-low-symbolic.svg battery-level-40-symbolic.svg
sudo ln -sf battery-low-symbolic.svg battery-level-30-symbolic.svg
sudo ln -sf battery-caution-symbolic.svg battery-level-20-symbolic.svg
sudo ln -sf battery-caution-symbolic.svg battery-level-10-symbolic.svg
sudo ln -sf battery-empty-symbolic.svg battery-level-0-symbolic.svg

# --- Create symbolic links for charging states by mapping them to generic charging states ---
echo "--- Creating links for charging states..."
sudo ln -sf battery-full-charging-symbolic.svg battery-level-100-charging-symbolic.svg
sudo ln -sf battery-full-charging-symbolic.svg battery-level-90-charging-symbolic.svg
sudo ln -sf battery-good-charging-symbolic.svg battery-level-80-charging-symbolic.svg
sudo ln -sf battery-good-charging-symbolic.svg battery-level-70-charging-symbolic.svg
sudo ln -sf battery-good-charging-symbolic.svg battery-level-60-charging-symbolic.svg
sudo ln -sf battery-good-charging-symbolic.svg battery-level-50-charging-symbolic.svg
sudo ln -sf battery-low-charging-symbolic.svg battery-level-40-charging-symbolic.svg
sudo ln -sf battery-low-charging-symbolic.svg battery-level-30-charging-symbolic.svg
sudo ln -sf battery-empty-charging-symbolic.svg battery-level-20-charging-symbolic.svg
sudo ln -sf battery-empty-charging-symbolic.svg battery-level-10-charging-symbolic.svg
sudo ln -sf battery-empty-charging-symbolic.svg battery-level-0-charging-symbolic.svg

# --- Create links for other special-name icons ---
echo "--- Creating links for special-name icons..."
sudo ln -sf battery-good-symbolic.svg battery-action-symbolic.svg
sudo ln -sf battery-full-charging-symbolic.svg battery-level-100-charged-symbolic.svg

# --- Finally, refresh the icon cache and restart the panel ---
echo "--- Refreshing icon cache and restarting panel..."
sudo gtk-update-icon-cache -f -t /usr/share/icons/Windows-10-Icons/
xfce4-panel --restart

echo "Fix applied successfully!"

# === END OF SCRIPT ===
  1. Solution / Workaround (解决方案 / 变通方法)
    I was able to permanently fix this issue by creating symbolic links. This forces the system to use the existing generic symbolic icons for all the missing specific-level states. This is a great workaround for other users who might face the same problem.
    (我通过创建符号链接的方式,永久性地解决了这个问题。这个方法强制系统为所有缺失的、带具体百分比的状态,都使用现有的通用符号图标。这对于其他可能遇到同样问题的用户来说,是一个很好的变通方法。)

I hope this information is helpful for the project maintainer and other users. Thank you for this great theme!
(希望这些信息对项目维护者和其他用户有所帮助。感谢您创作的这个优秀主题!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions