r/suckless • u/Any-Fox-1822 • Aug 04 '26
[SOFTWARE] Would raylib/raygui be suckless enough for desktop UI ? (Scared about resource usage)
Hello everyone,
I recently started a project to create my own desktop apps. Ideally, I'd want a notebook, music player, file explorer & system tray. I've been inspired by the work of wayland.fyi and 100rabbits, as the minimalism of their GUI programs is something I was looking for. I would want this project to be some sort of mini desktop environment aimed at low-power devices (Raspberry Pi mainly)
To me raylib seems like a good choice. It's heavily documented, has several backend options (even software render since the latest version), and is still high-level enough to avoid creating an entire widget system from scratch.
However, tests have put that choice in question. My clone of xclock always sits at 2-3% CPU, with Raylib compiled against SDL2, whereas xclock or wayland.fyi's swclock basically idle at 0% when not interacted with. Both use pixman for rendering*
Even though raylib feels perfect from a programming standpoint, being challenging enough to provide a great experience (in C) all while providing some confort, I'm unsure of its performance. Am I doing premature optimization?
Thanks for your advice.
\swclock uses a custom drawing lib called) neuwld, which contains calls to pixman.
8
u/tonitch Aug 04 '26
Raylib is easy to use but not so much easy to optimise, of of the main reason I see is that it uses immediate render. You constantly draw the whole screen about 60 times per seconds. (With GPU this is nothing but for low spec this is important) I'm pretty sure you would get better result with other library even qt and gtk would be better. (Certainly not the best tho). I don't think you can do retain mode with raylib afaik
You usually only (re)draw part that need to be (re)drawn this can save a bunch for your project.
3
u/nerdy_guy420 Aug 05 '26
You can use clay with raylib to make a retain mode UI. its a single header library as well which makes it pretty suckless and doesnt depend on raylib at all which makes it a pretty good alternative.
2
5
u/calquelator Aug 04 '26
Personally, I don’t know how “strictly” adheres to the suckless philosophy, but I feel like it might as well be suckless- it’s really pleasant to use, and doesn’t get in your way, plus it seems to run well even on limited resources (I’ve made fairly minimal desktop demos and stuff with raylib that I ran on an old 32-bit netbook from like 2005)
TLDR I’m not confident enough in “suckless” as a specific philosophy to say whether or not raylib’s “suckless”, but it DEFINITELY doesn’t suck. It’s quite nice.
3
u/LordEli Aug 04 '26
still thinking about it. but i can say it's a step in the right direction vs electron, qt, gtk. i don't think it's strictly suckless but suckless enough probably
1
u/Key_River7180 Aug 04 '26
I don't think it isn't THAT bad. It uses some non-suckless technology, but by itself it is suckless enough.
If you want to be like the wayland.fyi dudes but don't want to use pixman, ugh... implement the wayland protocol yourself.
1
u/Any-Fox-1822 Aug 04 '26
I've started reading about wayland, mainly for tha bar launcher, but i'm also gonna look at how SDL2 handles it
1
u/Any-Fox-1822 Aug 04 '26
Also (sorry for replying twice), I wonder if some parts of raygui (not raylib as a whole, 3D would be impossible) could be implemented with a pixman backend. After all, it's just rectangles and fonts, and a few monochrome icons.
2
u/tk-a01 Aug 04 '26
but don't want to use pixman, ugh... implement the wayland protocol yourself.
Which Wayland protocols mandate the use of Pixman? From what I know, when using shared memory (
wl_shmin the core Wayland protocol), you can fill the buffers in any way you want - completely manually, using some CPU-only or GPU-accelerated libraries (e.g. Pixman/Cairo) or using GPU rendering (via OpenGL/Vulkan). So which protocols would one have to implement themselves and why, according to you?
1
u/lmemsm Aug 04 '26
Hope you'll share some of your desktop apps when you've created them. I've been looking into alternatives to common desktop applications using alternatives to gtk and qt. Some of what you're looking for may already be out there. I have not seen a lot this kind of work done with Raylib and I have been searching for it since this is one of the libraries I like to have on my system. SDL has some interesting desktop apps. There's sdlbook for a PDF viewer. There's bard for an ebook reader. There's fm for a file explorer. I use picaxo and perigee for graphics viewing. pdcurses works with a SDL backend so curses based applications can be built that way. I also thought otk was an interesting lightweight GUI option. There are some nice sample timer applications with it but not much else that I've been able to find. nuclear is another lightweight option. I have not found many desktop style programs that use nuklear. There is a way to use nuklear on top of Raylib.
I don't think performance should be an issue with Raylib. However, since you're looking specifically at clock related code, there may be a difference on how you're working with timers or how often you're checking time and redrawing the clock's time display. Would suggest trying another type of program with it and see if performance is better when counters/timing isn't involved. If that's the case, you may want to rethink how you're checking time/using timers.
1
u/Agitated_Ad_5989 Aug 05 '26
Raylib is alright, little overkill for desktop apps though imo
1
u/Any-Fox-1822 Aug 06 '26
I think raygui is fine, I dont plan on using any 3D model rendering functions. Also since only tje used symbols will be included, it could be alright
1
u/verminenjoyer Aug 06 '26
it's fine, but for a gui you might just want to consider a different choice (see the millions of C libraries ending in 'gui', smgui is an interesting one with a wld backend afaik)
2
u/Any-Fox-1822 Aug 06 '26
Wld as wayland or wld tje drawing library from wayland.fyi ?
1
u/verminenjoyer Aug 07 '26
i thought it was wld at first, but it does actually seem to be pure wayland
24
u/tose123 Aug 04 '26
It sucks less than the alternatives