jonhoo / buzz

A simple system tray application for notifying about unseen e-mail

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

System tray icons

DanielVoogsgerd opened this issue · comments

I recently added Buzz to my system and so far I've really liked it.

I noticed that the icons in the system tray were not showing up. It looks like it's because the icons are hardcoded and are not installed on my system. Now I'm thinking of the best way of making these icons configurable, and so far the best solution I've come up with it making a special category in config.toml that is not an account but instead defines the location of the icons.

What do you think?

Ah, interesting. I actually don't know the best way to set icons without hard-coding the path... Making the icons customizeable would certainly be one way to do it though. Any chance you might be able to submit a PR? I'd be happy to review!

Absolutely. I was thinking of either one of three solutions.

  • Moving $XDG_CONFIG_HOME/buzz.toml to $XDG_CONFIG_HOME/buzz/accounts.toml and creating a config.toml for settings.
  • Prefixing the toml-groups (is that what they are called?) with something like account-
  • Creating a settings group, and filter it when the accounts are converted to a table.

Any preference?

Also, I must admit, I've only been writing rust for like 3 days, so this might take a couple of attempts :)

I think maybe the nicest thing would be to have accounts be an array of tables, so that the (single) configuration file ends up looking like this:

[icons]
empty = "/usr/share/icons/Faenza/categories/scalable/applications-mail.svg"
# ...

[[account]]
name = "personal"
server = "imap.gmail.com"
port = 993
username = "jon@gmail.com"
pwcmd = "gnome-keyring-query get gmail_pw"

[[account]]
name = "work"
server = "imap.outlook.com"
port = 993
username = "jon@outlook.com"
pwcmd = "pass outlook_pw"

Ah, cool, did not know this was a thing. Sounds like a plan 👍

Feel free to submit a draft PR and I'll try to guide you along if you want :)

Currently we're using set_icon_by_file, but it looks like set_icon_by_name will be supported soon(?), which automatically uses the current theme.
qdot/systray-rs#41

Ooooh, that'd be neat!

Unfortunately, systray-rs seems to be deprecated and archived (dec 2020). The version of libappindicator-rs it depends on (version 0.5.1) does not build anymore on my machine. I looked into a couple alternatives and tray-item or tray-icon seem like the best alternatives.

tray-item should even be cross platform which could be nice. However, the different platforms do have different apis it seems. This should not be a big problem, however it would not be a drop in replacement.

What if we use some hard-coded icons by default and optionally let users set their custom icons either by name or file (using tray-item).

Here is some icons i have designed for buzz (inspired by FontAwesome icons):

icons

What do you think?

Yeah, the whole system tray story on Linux in particular is a mess at the moment. There's some ongoing work to standardize, but it looks like many of the toolkits are pseudo-dropping libappindicator without a real replacement being available. I'd be okay switching over to something else, especially if it lets us abstract away from the choice!

I'd prefer to not hard-code our own icons and instead use the ones from the user's theme — that at least feels like a more sane default. But maybe we can allow users to override the icons in the config?

I'd prefer to not hard-code our own icons and instead use the ones from the user's theme

I'd love to do this, sadly the icons we want are a little rare in themes found in linux and if found, they are used by other apps such as NetworkManager (in case of connect and disconnect) witch cause confusion for the user.

But maybe we can allow users to override the icons in the config?

If we do this, we can always fallback to our hard-coded icons if there is no user-icon provided or not existed.