MaxVerevkin / i3bar-river

A port of i3bar for wlroots-based compositors
GNU General Public License v3.0
42 stars 6 forks source link

tray icons #7

Open p00f opened 1 year ago

p00f commented 1 year ago

I'm willing to work on this, can you tell me how to start? I found https://docs.rs/stray/0.1.3/stray/message/tray/struct.StatusNotifierItem.html which returns the icon name and/or the icon pixmap, how do I actually draw these?

MaxVerevkin commented 1 year ago

Hi.

It looks like stray uses tokio, so the first step would be to start using tokio ourselves (which I used to do at some point but removed (https://github.com/MaxVerevkin/i3bar-river/commit/91381b2c1bb0ee5cb4755ac80769a7838874bbe6) because it wasn't really necessary at that point).

Then you can create a tray module, in which you will keep track of the tray state.

To draw an icon, you will need to create a Surface, and then

cairo_ctx.set_source_surface(&surface, x, y).unwrap();
cairo_ctx.paint().unwrap();
p00f commented 1 year ago

I see, thanks

On Fri, 12 May 2023 at 12:32, Max Verevkin @.***> wrote:

Hi.

It looks like stray uses tokio, so the first step would be to start using tokio ourselves (which I used to do at some point but removed (91381b2 https://github.com/MaxVerevkin/i3bar-river/commit/91381b2c1bb0ee5cb4755ac80769a7838874bbe6) because it wasn't really necessary at that point).

Then you can create a tray module, in which you will keep track of the tray state.

To draw an icon, you will need to create a Surface https://docs.rs/cairo-rs/0.17.0/cairo/struct.Surface.html, and then

cairo_ctx.set_source_surface(&surface, x, y).unwrap(); cairo_ctx.paint().unwrap();

— Reply to this email directly, view it on GitHub https://github.com/MaxVerevkin/i3bar-river/issues/7#issuecomment-1545272786, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIWNSZ3JQ2VZOL3VI6TBFOTXFXOBXANCNFSM6AAAAAAX7BPAX4 . You are receiving this because you authored the thread.Message ID: @.***>

MaxVerevkin commented 1 year ago

So, a high-level plan can be

  1. Transition to tokio.
  2. Add an option to enable the tray and just render the icons.
  3. Add config options to customize the appearance of those icons.
  4. Implement menus, clicks, popups.