frewsxcv / rust-dark-light

Rust crate to detect if dark mode or light mode is enabled
https://crates.io/crates/dark-light
73 stars 12 forks source link

zbus is a heavy dependency #15

Closed parasyte closed 1 year ago

parasyte commented 2 years ago

zbus replaced dbus in edff243a182d3293b8d81d3d9417ed9f725bc3cb and the change was requested in https://github.com/frewsxcv/rust-dark-light/pull/4#discussion_r779083783

Some stats according to lib.rs:

Related: https://gitlab.freedesktop.org/dbus/zbus/-/issues/254

frewsxcv commented 2 years ago

If you would like to open a PR replacing it, then I'd review it

Be-ing commented 2 years ago

Please do not replace zbus with dbus! dbus requires a C library. zbus is pure Rust.

Those statistics are misleading. They do not account for the libdbus C library and its dependencies.

frewsxcv commented 2 years ago

Maybe we could have it behind a feature flag? So you can choose one or the other

Be-ing commented 2 years ago

If you insist, but IMO it'd be pretty silly to have two implementations of the same thing.

frewsxcv commented 2 years ago

Nah I don't insist, I'd rather have a pure-Rust dependency tree

frewsxcv commented 2 years ago

[(dependencies; 27 are required)](https://lib.rs/crates/zbus: 1MB + ~5–7MB (dependencies; 27 are required))

For reference: https://gitlab.freedesktop.org/dbus/zbus/-/blob/main/zbus/Cargo.toml

frewsxcv commented 1 year ago

Many zbus dependencies are optional, as per the latest release: https://gitlab.freedesktop.org/dbus/zbus/-/releases So zbus might be lighter now

mwcampbell commented 1 year ago

I want to push back a bit on this one, because I anticipate the same complaint about AccessKit's upcoming zbus-based AT-SPI implementation, and because I think choosing light versus dark mode is an accessibility issue in itself. While we should certainly avoid adding gratuitous complexity and code bloat, we should also keep in mind that a human interface that accommodates the needs of a variety of users is fundamentally not a simple, small problem, so it can't have a simple, small solution. Whether or not D-Bus is over-complicated, it's what we have on the free desktops, and meeting the needs of users must come first. I think dark-light is right to prefer a pure-Rust dependency tree. So @frewsxcv, you should feel free to dismiss this issue.

jacksongoode commented 4 months ago

Is zbus any lighter today than when this issue was made? @frewsxcv

frewsxcv commented 4 months ago

I have no idea

jacksongoode commented 4 months ago

I think zbus is actually smaller now?

parasyte commented 4 months ago

https://lib.rs/crates/zbus gives a rough estimate of weight. When I created this, its dependencies were estimated to be 5-7MB. It's now 10-26MB.

jacksongoode commented 4 months ago

Hmm, there's not really any alternative in the rust world though is there? I suppose dark-light could make z/dbus a feature that can be installed separately

Be-ing commented 4 months ago

No, there isn't a Rust alternative to zbus. There's no actionable request here. If you don't like zbus, improve it or write an alternative.

parasyte commented 4 months ago

It is actionable, which is different from maintainers having no interest.

frewsxcv commented 4 months ago

There is no actionable request.