How to change the Telegram icon on the upper GNOME panel to a custom one? I've earlier used to override them by placing into ~/.local/share/icons/hicolor/scalable/status. Doesn't seem to work now. It's a Flatpak version of Telegram.
Assistant
Changing the Telegram icon in the GNOME panel when using the Flatpak version involves overriding the application’s icon within the Flatpak’s accessible icon theme. Flatpak applications are sandboxed, which means they have isolated environments, but they still utilize the host system’s icon themes. Here’s a step-by-step guide to help you achieve this:
1. Identify the Correct Icon Name
First, determine the exact name of the Telegram icon used by the Flatpak version. This is typically specified in the application's desktop entry file.
This command searches for the Icon entry in the Telegram Flatpak desktop file. It often returns something like Icon=telegram.
2. Prepare Your Custom Icon
Ensure your custom icon matches the expected format and size:
Format: Preferably SVG for scalability, but PNG works as well.
Naming: Use the exact icon name identified in the previous step (e.g., telegram.svg).
Dimensions: If using PNG, common sizes include 24x24, 32x32, etc. SVGs are scalable and don’t require specific dimensions.
3. Place the Custom Icon in the Correct Directory
To override the icon, place your custom icon in the appropriate directory within your local icon theme. Flatpak applications typically use the host’s icon themes, so placing the icon in ~/.local/share/icons should suffice.
For the changes to take effect, you’ll need to restart GNOME Shell and the Telegram application.
Restart GNOME Shell:
Press Alt + F2, type r, and press Enter. (Note: This works if you're using Xorg. On Wayland, you might need to log out and log back in.)
Restart Telegram:
Close Telegram completely and reopen it.
6. Verify the Changes
Check the GNOME panel to see if the Telegram icon has been updated. If it hasn’t changed:
Double-Check Icon Names:
Ensure that the custom icon’s filename exactly matches the icon name specified in the desktop entry.
Check Icon Formats:
Ensure the icon is in the correct format (SVG or PNG) and is not corrupted.
Ensure Proper Permissions:
Verify that the icon file has appropriate read permissions:
Alternative Approach: Modify Flatpak’s Icon Theme (Advanced)
If the above steps don’t work, you might need to delve deeper into Flatpak’s sandbox. This approach is more advanced and generally not recommended unless you're comfortable with Flatpak internals.
Access the Flatpak Environment:
bash
flatpak run --command=sh com.telegram.desktop
Within the Shell, Navigate to the Icon Directory:
bash
cd /app/share/icons/hicolor/scalable/apps
Replace the Existing Icon:(Note: Changes here might be overridden by Flatpak updates.)
Consider Using a Non-Flatpak Version
If icon customization is crucial and the Flatpak approach proves too restrictive, consider installing Telegram using a different method, such as:
AppImage: A portable application format.
Native Package Manager: Install from your distribution’s repositories or using snap, npm, etc.
Summary
Overriding the Telegram icon for the Flatpak version involves placing your custom icon in the appropriate local icon directories, ensuring it has the correct name and format, updating the icon cache, and restarting the necessary components. If Flatpak’s sandboxing restricts this process, alternative installation methods might offer more flexibility for customization.