Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

penrose_ui: Setting background color of status bar to black (0x000000 or 0x000000ff) results in crash #283

Closed
mejo13 opened this issue Nov 10, 2023 · 1 comment
Labels
bug Something isn't working question A question about how to use penrose

Comments

@mejo13
Copy link

mejo13 commented Nov 10, 2023

Penrose doesn't start but just crashes with this error message:

Error: Custom("Unable to allocate the requested color using Xft")

I figured that this patch fixes this for me.

diff --git a/src/lib.rs b/src/lib.rs
index c7e3a98..a05566c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -263,7 +263,7 @@ impl Color {

     /// Render this color as a #RRGGBB hew color string
     pub fn as_rgb_hex_string(&self) -> String {
-        format!("#{:x}", self.rgb_u32())
+        format!("#{:0>6x}", self.rgb_u32())
     }

     /// 0xRRGGBB representation of this Color (no alpha information)

But i'm unsure whether i fixed my own mistake or if this realy is a bug in penrose_ui?!

@mejo13 mejo13 added the question A question about how to use penrose label Nov 10, 2023
@sminez
Copy link
Owner

sminez commented Nov 10, 2023

Hi @mejo13, thank you for raising this. It does indeed look like it is a bug with how I am generating those strings and the fix you have here is the right one. I've got the fix plus some quick tests around the behviour sorted out so I'll get that pushed now 👍

@sminez sminez added the bug Something isn't working label Nov 10, 2023
@sminez sminez closed this as completed Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question A question about how to use penrose
Projects
None yet
Development

No branches or pull requests

2 participants