flathub / eu.betterbird.Betterbird

https://flathub.org/apps/details/eu.betterbird.Betterbird
6 stars 0 forks source link

Customize tray icon #158

Open bmp opened 3 weeks ago

bmp commented 3 weeks ago

Hello,

I have the following two icons I am using: default newmail

I am able to change icons based on the https://www.betterbird.eu/expert-tips/index.html when I use the application from source.

How can I customize the tray icon when I use the flatpak?

mfschumann commented 3 weeks ago

For the flatpak version of Betterbird to pick up the icons, they

On my computer, $XDG_DATA_DIRS starts with two folders where flatpak puts the icons of the installed apps (.../flatpak/exports/share). I would not recommend messing around in these folders since eventually a flatpak update will restore the original state. Instead, prepend a custom folder to $XDG_DATA_DIRS and put the custom icons in there according to the two requirements above (correct subfolder, correct name).

bmp commented 3 weeks ago

So, here is what I have done,

  1. Setup $XDG_DATA_DIRS and restarted session
    echo $XDG_DATA_DIRS 
    /home/bmp/.local/icons/hicolor/scalable/status:/home/bmp/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
  2. Copied files to ~/.local/icons/hicolor/scalable/status
    
    tree ~/.local/icons
    /home/bmp/.local/icons
    └── hicolor
    └── scalable
        └── status
            ├── eu.betterbird.Betterbird-default.svg
            └── eu.betterbird.Betterbird-newmail.svg

3. Relaunched Betterbird: and the icons remain the same.
![Screenshot_20240607_203730](https://github.com/flathub/eu.betterbird.Betterbird/assets/1095177/70c0e841-924e-4813-be19-35b173d3bed5)

If it matters, I am on OpenSUSE Tumbleweed with KDE.
mfschumann commented 3 weeks ago

Only the part of the path before icons/hicolor/scalable/status needs to go into $XDG_DATA_DIRS, so /home/bmp/.local in your case.

bmp commented 3 weeks ago

The icon does not change even with the updated $XDG_DATA_DIRS to,

echo $XDG_DATA_DIRS 
/home/bmp/.local:/home/bmp/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
mfschumann commented 3 weeks ago

You could try restarting your session again after putting the icons into the correct location. Maybe the icons need to be present when the session starts?

bmp commented 3 weeks ago

I actually rebooted the machine too!

mfschumann commented 3 weeks ago

Hm, that is strange. I will try to reproduce and debug the issue on my machine, but that is going to take a while.

bmp commented 3 weeks ago

Hm, that is strange. I will try to reproduce and debug the issue on my machine, but that is going to take a while.

No hurry and thanks for trying. I was earlier using the direct download method from Betterbird and got annoyed with having to manually update and thought flatpak would be a good alternative, so this isn't a deal breaker for me.

mfschumann commented 1 day ago

On my fedora Silverblue machine with GNOME, I was able to customize the tray icon like this:

  1. Create folder ~/.local/share/icons/hicolor/scalable/status
  2. Place eu.betterbird.Betterbird-default.svg and eu.betterbird.Betterbird-newmail.svg in this folder
  3. Reboot

After that Betterbird showed the custom tray icon.

Note that I did not even have to add anything to $XDG_DATA_DIRS because $XDG_DATA_HOME is checked first for matching icons. On my machine the latter is unset so it defaults to $HOME/.local/share (spec).

The only obvious differences between my test and yours are

Could you check if placing the icons in ~/.local/share/icons/hicolor/scalable/status and undoing your changes to $XDG_DATA_DIRS works for you too?

Btw, thanks for posting the icons. That monochrome style matches my desktop quite nicely :-)

bmp commented 1 day ago

Strange, I followed your steps, and it still doesn't work for me. I on on KDE, otherwise everything else remains the same,

tree ~/.local/icons
/home/bmp/.local/icons
└── hicolor
    └── scalable
        └── status
            ├── eu.betterbird.Betterbird-default.svg
            └── eu.betterbird.Betterbird-newmail.svg

Here is the XDG variables,

echo $XDG_DATA_DIRS
/home/bmp/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop

and on my machine, $XDG_DATA_HOME is unset on my machine as well.

I have restarted the machine too.

mfschumann commented 1 day ago

Note it should be ~/.local/share/icons, you seem to be missing the share part.

bmp commented 1 day ago

Here is the revised one,

/home/bmp/.local/share/icons/hicolor/scalable/
└── status
    ├── eu.betterbird.Betterbird-default.svg
    └── eu.betterbird.Betterbird-newmail.svg

I have done a couple of restarts with and without ~/.local/share/icons,

/home/bmp/.local/share/icons:/home/bmp/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop

But with the same effect.

mfschumann commented 19 hours ago

I've spun up a Tumbleweed VM and tested the approach that I described in https://github.com/flathub/eu.betterbird.Betterbird/issues/158#issuecomment-2204200334, and it worked:

image

So it's not a KDE vs. GNOME issue, but seems specific to your setup. Can you try if the approach works under a freshly created user account?

bmp commented 10 hours ago

I'll give this a go and report back.