JakeStanger / ironbar

Customisable Wayland gtk bar written in Rust.
https://crates.io/crates/ironbar
MIT License
560 stars 47 forks source link

[UPower] UPower module crashes bar on desktop #694

Closed GameDungeon closed 1 month ago

GameDungeon commented 1 month ago

Describe the bug

A clear and concise description of what the bug is.

If I use the UPower module on a Desktop PC with no battery it crashes the entire bar. I use nix and share my config between my desktop and my laptop, but I currently can't as my laptop's config will crash the bar on the desktop.

To Reproduce Steps to reproduce the behavior: Add UPower module to a desktop PC's bar

Expected behavior

A clear and concise description of what you expected to happen.

Not having the bar crash (Adding an option to hide the UPower if there is no battery detected would be great as well)

System information:

 - Distro: NixOS
- Compositor: Hyprland
 - Ironbar version: 0.15.1

Additional context

Add any other context about the problem here.

Screenshots

If applicable, add screenshots to help explain your problem.

GameDungeon commented 1 month ago

After further testing it turns out that the UPower module also crashes on my laptop

JakeStanger commented 1 month ago

Can you provide logs please?

GameDungeon commented 1 month ago

Here is the log file, if you want I can give the rust backtrace

2024-08-09T03:09:19.490116Z  WARN ironbar::image::provider: Failed to find image: content-loading-symbolic
2024-08-09T03:09:19.560997Z  WARN ironbar::image::provider: Failed to find image: content-loading-symbolic
2024-08-09T03:09:19.566535Z  WARN ironbar::image::provider: Failed to find image: dialog-question-symbolic
2024-08-09T03:09:19.567801Z  WARN ironbar::image::provider: Failed to find image: network-wireless-symbolic
2024-08-09T03:09:19.569863Z  WARN ironbar::image::provider: Failed to find image: network-wireless-symbolic
2024-08-09T03:09:21.022212Z  WARN ironbar::clients::volume: Couldn't find sink: @DEFAULT_SINK@
2024-08-09T03:09:21.599689Z  WARN ironbar::clients::volume: Couldn't find sink: @DEFAULT_SINK@
2024-08-09T03:09:21.725570Z  WARN ironbar::clients::volume: Couldn't find sink: alsa_output.usb-Blue_Microphones_Yeti_Stereo_Microphone_797_2018_07_03_46695-00.pro-output-0
2024-08-09T15:01:29.568429Z  WARN ironbar::image::provider: Failed to find image: content-loading-symbolic
2024-08-09T15:01:29.570633Z ERROR ironbar::logging: The application panicked (crashed).
Message:  failed to get display device for UPowerProxy(Proxy { inner: ProxyInner { inner_without_borrows: ProxyInnerStatic { dest_owner_change_match_rule: OnceCell(Uninit) }, destination: WellKnown(WellKnownName(Str(Static("org.freedesktop.UPower")))), path: ObjectPath("/org/freedesktop/UPower"), interface: InterfaceName(Str(Static("org.freedesktop.UPower"))), property_cache: Some(OnceCell(Uninit)), uncached_properties: {} } })
Location: src/clients/upower.rs:18

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
2024-08-09T15:01:29.577452Z  WARN ironbar::image::provider: Failed to find image: network-wireless-symbolic
JakeStanger commented 1 month ago

Okay so I'm not sure why yours is crashing. I'd double check you actually have Upower installed and running on your machine? I just tested on my desktop and it runs there at least, and I know it works on my laptop.

I'm just merging a fix that should avoid it from hard-crashing on error at least.

GameDungeon commented 1 month ago

Oh, The wiki page for that does not say anything about needing another piece of software so I never thought to check (I thought that was just the name of the widget) Let me try that with the software lol

JakeStanger commented 1 month ago

I guess that wasn't tremendously clear if you don't know. I've just added a note to the wiki.

GameDungeon commented 1 month ago

Well thank you, between the wiki note and that PR I think I can close this now.

JakeStanger commented 1 month ago

Awesome np, cheers for confirming