
At the Qt Contributors Summit, Johannes‘ showed me his Qt/Caca Lighthouse plugin. Caca is a graphics library to output text instead of pixels. So this plugin lets you run Qt programs on the console
His code needed some love, so I forked it and cleaned it up. Caca does not provide a event fd and so we have to keep polling caca for events. Since this wasn’t ideal, I moved the event handling to a separate thread and blocked for events. Unfortunately, I found that the caca library is not thread-safe and rendering and processing events in separate threads makes caca crash at randomly. So, I ended up moving the rendering to the event processing thread and having to resurrect the 20ms event timer again
The cool thing though is that now Qt renders to QImage in the main ui thread and hands it off to caca. Caca opens a X connection (or similar), converts the image into text, displays a window and handles events in another thread. With some refactoring and thanks to QMetaObject::invokeMethod, the threaded and non-threaded rendering are pretty much the same and can be switched using an environment variable (THREADED_CACA=1).
If you want to hack further, code is on gitorious. (Caca doesn’t seem to deliver gpm events with ncurses, so that would be a nice fix to have)
Update: Welcome slashdot readers
This. Is. 1337!
That is pure awesomeness! It might even be useful, but I’m not sure what for. Have there been any ideas?
Is it a coincidence this is this is published just after we hear about accelerated text rendering in QML? Perhaps this is the compatibility layer we’ve been promised…
caca means poop in spanish :p
@Paul: It’s a great demo for publicizing Lighthouse
Hopefully, it inspires others to port Qt to other platforms.
@Paul:
The purpose it served for the original developer was to get Qt running on a X-less server hovering near the coffee machine.
I confirm, that is not the best name for a software, so, can we rename it as “Ca Ca”, or “Cac A”. Sorry for beeing childish… but “poop”?
caca is NOT a good name, take my word
@Mario, @Spanish person: I didn’t give libcaca it’s name. libcaca is an existing project by Caca Labs (http://caca.zoy.org/wiki/libcaca).
Libpoop, another great name… Bad, bad.
what about the linux’s framebufer ? it would be looking much better
than ascii characters.
Caca means crap/shit in Romanian. Just sayin…
I think they are well aware of the meaning of the word, you’d realize that if you visited the project page.
caca even in german means shit
My main usecase actually is to have my ssh login message animated.
I also have the qtcompositor running with caca backend, to have multiple applications composited within the same console.
There are plenty of use cases
The Library name is actually unfortunately ridiculous for all those speaking a latin-based language.
Please, please, change its name! For the sake of the world.
The name is intentional. The caca project page explains the name by a quote french quote which approximately translates by:
“There’s nothing really beautiful that has no use; what is useful is ugly, because it is the expression of some need, and those of man are ignoble and disgusting, as his poor and crippled nature. The most useful place in a house is its toilets.”
Let’s add that the authors of the projects seem to be proud of their project being unuseful. Another quote on the same page translates like this :
“What did you say ? It’s unuseful ? I do know it.
But you do not fight in hope of victory.
No, no it’s far more beutiful when it is not useful !”
from Cyrano de Bergerac, by Edmond Rostand.
Animated Login-message? That’s cool! Can you show an example you are using?
Thank you
How well does the demo browser run? Could this be used without X11? (i.e. a console browser)
Nice blog right here! Also your web site a lot up fast! What host are you using? Can I get your affiliate hyperlink on your host? I wish my site loaded up as fast as yours lol
Caca = shit in spanish.. nice name ! xD