-
Hey guys I wanted to make a taskbar, kinda like polybar. Is it possible to draw it directly on the screen using your library on Windows, Linux (x.org display server) and on Linux (Wayland display server)? Furthermore does it use retained graphics or immediate graphics? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Short answer, not at all. Long answer, pixels can render to whatever implements the RawWindowHandle trait from that crate. You could set that up to be a Wayland surface or the x11 equivalent. However, there are many aspects of pixels that make it a poor choice for this sort of thing. By default, pixels has some stuff to handle pixel-perfect scaling for you, which isn't desirable for a bar. By default, pixels provides practically nothing in the way of useful functionality for a bar. No layout tools, no icon rendering, no text rendering, nothing. Text rendering is especially a big deal - it's 90% of the bar's functionality, and you fundamentally won't get good text rendering with pixels. Pixels works by having you specify a logical window size you want to render to, and then scales that up. With HIDPI screens, or when making any sort of UI, this is a terrible choice. You don't want to render a tiny bar with small text and limited space for widgets and then scale it up - you want to render bigger to begin with to take advantage of smoother corner anti aliasing, smoother text rendering and less need to antialias it, more space to put widgets, etc. So for all these reasons, pixels is a terrible choice for writing a bar. I would look into using smithay's client toolkit (SCTK) for getting a wayland surface to draw to and very basic 2d rendering. For more advanced things like gradients, shadows, text, icons, you're going to need to find a general purpose 2d library like skia, or combine a couple of specialized crates probably. |
Beta Was this translation helpful? Give feedback.
-
I see mate thanks :) |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
pixels
gives you a texture for direct pixel manipulation, so its purpose is software rasterization. While it does work with some crates that implement software rasterization, likeraqote
, this crate is definitely not enough on its own to give you want you need.