Skip to content

Is this library suitable to create a taskbar? #205

Closed

Description

@Joe23232

Hey guys I wanted to make a taskbar, kinda like polybar.

image

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?

Activity

  1. JMS55 commented on Sep 20, 2021

    @JMS55
    Contributor

    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.

  2. Joe23232 commented on Sep 20, 2021

    @Joe23232
    Author

    I see mate thanks :)

  3. parasyte commented on Sep 20, 2021

    @parasyte
    Owner

    pixels gives you a texture for direct pixel manipulation, so it's purpose is software rasterization. While it does work with some crates that implement software rasterization, like raqote, this crate is definitely not enough on its own to give you want you need.

  4. Repository owner locked and limited conversation to collaborators on Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions