weigert / splash

Unix Data Splashing Tool
MIT License
172 stars 4 forks source link

Display usually windowed content on desktop? #22

Open cannyboy opened 2 years ago

cannyboy commented 2 years ago

Splash looks like something that could be useful for teaching programming to kids. Have the terminal or text editor on the left and the output on the desktop on the right. A bit like Swift Playgrounds: http://saltpigmedia.com/assets/Hello_World.jpg

Is there a way to output stuff to the desktop background, using splash, which would normally be displayed in its own window? For instance, a ruby2d window - https://github.com/ruby2d/ruby2d . Or even a TinyEngine window.

weigert commented 2 years ago

Hi. Sure this is possible. Can you be more specific about what you are trying to achieve though? Is this just an idea or for a specific project? Any specific scripting language, or homebrew it?

Splash is basically a modular system for doing non-windowed rendering; how you provide the data to it or render is really up to you. So I can think of a few things you could do to achieve what you want.

Either you have a code editor editing a file, which when saved has an interpreter program communicating with splash either rendering IN SPLASH or rendering to e.g. a texture which splash can render easily (would let you use the ES6 engine or perhaps a python interpreter, but rendered to the desktop background)

or

Write a terminal program which acts as an inline interpreter where you can issue commands to splash, which will render it to a desktop.

The advantage of using an "interpreter to texture" method is that the actual drawing would take place outside of splash, and you wouldn't have to implement the drawing engine yourself in C / C++. Im sure there are drawing engines out there that can produce PNG images from a script, splash can then easily display these on the desktop with transparency. Particularly for things like text and stuff.

Of course for dynamic things and animations, it would be more efficient to do it straight in C but the traedoff is ease of implementation.

Having splash also manage the text editing itself would be quite involved. I recommend the script -> interpret -> texture -> render approach, where you have some script.txt file and you run splash interpret script.txt, which uses an embedded interpreter to produce a texture and then renders this to the desktop, with a listener on the file for updating. The only thing you would have to write is the interpret program.

Let me know if you have any questions.

cannyboy commented 2 years ago

Well it was just a vague idea to put any normally windowed content straight onto the desktop background (without any window borders and title bars etc). For any purpose really, but simple programming seems a good fit. But I don't know if it this is outside the scope of splash, or if it is even possible.

I was imaging you would get the window id with something like wmctrl ( https://en.wikipedia.org/wiki/Wmctrl ), and then issue a command like send-window-to-desktop 1234 and it would put it on the desktop. Or if possible, send all windowed output from a certain program/process using a name or process-id send-process-to-desktop seaborn / send-process-to-desktop 56 . And then watch a file you were editing in vim, and each time you saved it, it would compile and appear on the desktop in the 'desktopped' window.