Code Monkey home page Code Monkey logo

splash's Introduction

splash

Unix Splash Screen Tool - turn your desktop into a 2D / 3D canvas

Made in C/C++ + XLIB

See below for distro / DE compatbility

Description

splash is a generic tool that provides a command-line interface for rendering non-windowed raw data directly onto your desktop environment.

splash transforms your entire desktop into a 2D / 3D canvas, for dynamic data or simple static overlays that can interact with your mouse and keyboard and trigger commands.

smbsplash.gif

Example of splash displaying an animated GIF on the desktop background.

fidget.gif

Example of splash displaying a full 3D OpenGL application (albeit a very basic one) with user interaction.

ttf.gif

Example of splash rendering truetype font text, with a bunch of options, in the foreground on the desktop.

This was originally written because I wanted to have a custom "splash screen" like those fancy, super expensive software packages have when starting up, with transparency and everything. Now it supports a full OpenGL context.

Features

splash rovides an elegant interface for creating a light-weight, "windowless" OpenGL context on your desktop. It also provides a simply system for accessing command line options and access to a pipe for streaming data to the visualization. Programs are dynamically linked so splash is very easy to extend (see below for details). The structure thereby allows for the development of light-weight, highly modular shader based desktop visuals.

- dynamically linked, shader-based execution modes
- super light code structure and execution cost
- streaming data to exeuction modes via pipes
- easy to develpo new execution modes

Usage

splash requires specification of an execution mode, which can then use piped data as well as options:

Reading:
  []      Required
  <>      Optional

Running:
<data |> splash [mode] <options/flags>

Options:

  -p [x y w h]  Position Splash Quad
  -t [s]        Splash timeout in seconds (integer)

Flags:

  --t     Test configuration file
  --v     Verbose mode

  --bg    Place splash in background
  --fg    Place splash in foreground (default)
  --ni    Splash no-interact
  --ns    Disable splash shadows (compton)
  --a     Display splash on all desktops

Modes (included by default):

  help      Display help message (this message)
  info      Display info message

  fidget    Display a 3D fidget spinner (lol)
  hairy     A different fidget spinner
  spiky     Yet another different spinner

  img       Display .png image
  [data]:   Image file name

  gif       Display .gif image (note: only full replacing gifs)
  [data]:   GIF file name

  text      Render truetype text (static)
  [data]:   Text to render
    -ff [font]    Font face (searches in ~/.fonts/, default "arial.ttf")
    -fc [hex]     Text color (hex code, e.g. 0xFFFFFF)
    -fs [size]    Font size, positive integer
    -v  [0,1,2]   Vertical Align [center, up, down]
    -h  [0,1,2]   Horizontal Align [center, left, right]

Data Piping

Data can be piped into a splash directly at the start, using e.g.:

echo "splash" | splash text -p 100 100 800 400 --bg --ns  -ff "arial.ttf" -fs 100

Every splash program will also additionally open a numbered named pipe in ~/.config/splash/pipe/, on which it (can) listen for data stream to affect the visualization. The name of the pipe is returned by splash:

> splash text -p 100 100 800 400 --bg --ns  -ff "arial.ttf" -fs 100
$ /home/user/.config/splash/pipe/pipe0

which can then be used to stream data from another source, e.g.:

> watch -n1 'date +%H:%M:%S > /home/user/.config/splash/pipe/pipe0'

resulting in a clock visualized in the splash opened previously with the correct settings.

Note that what happens with the data depends on the programming of the execution mode.

Examples

To test your installation of splash and see some application examples, check the test folder. It comes with some data provided.

Installation

Dependencies

Compiler:         g++
Rendering:        OpenGL, glX, GLEW
X-Server:         X11, Xfixes, Xrender
Boost:            boost, boost_system, boost_filesystem

All of these should be available as packages for your favorite distro.

Setup

Run the script setup.sh with privileges.

The script will make sure that the required directories exist and will setup splash at ~/.config/splash.

The script will also ask if you wish to compile splash and the execution modes.

The execution modes are placed in ~/.config/splash/exec and splash is placed in /usr/local/bin.

Manual Compiling

If you wish to compile manually, use the makefiles in splash/Makefile and program/Makefile:

# ./splash:
  make build
  sudo make install
# or
  sudo make splash

# ./program:
  make build
  make install
# or
  make all

Note that splash is separate from the actual execution modes. Execution modes are compiled separately (linked at runtime by splash). Execution mode installation does not require privilege.

Compilation Issues

If you have problems with compiling search the closed issues to see if there is a solution and otherwise feel free to open a ticket.

Common problems might include: Incorrect linking in the make files, because your distro places libraries in a different location, and slightly different names of the libraries in #include directives.

Compabitibility / Requirements / Configuration

This is just from some basic tests I can run on my computer. If you can compile / test on other distros and DEs, please open an issue so I can add it here.

Distros:

    Ubuntu 18           Compiles successfully
    Arch / Manjaro      Compiles successfully (see issues)
    ...                 feel free to open an issue for your distro!

Desktop Environments:

    Gnome / Ubuntu      Works fully
    Openbox             Works fully
    XFCE                Works fully
    bspwm               Works fully (requires config, see below)

    i3                  *Restricted (see below)*
    i3-gaps             Not tested

    ...                 Feel free to open an issue for your DE!

Note: Some WMs require additions to their config.

splash wiki: window manager compatibility and system configuration

Customization & How it Works

config

I am currently working on a configuration system to make the display behavior more easily customizable.

Possible configuration options include color-schemes, transparency options and event triggers.

Custom Mode

Currently, building custom execution modes requires knowledge of C++ and OpenGL. If you don't have the experience but you have an idea for a type of visualization you would like, let me know.

splash provides a "windowless"* OpenGL context and a system for modularized data visualization using small shader programs ("execution modes"), which have access to the piped-in data and user-input events.

Note: An X11 window technically exists, it is just made "transparent" to the desktop.

A generic "program" base class is exposed to user input (piped data, commandline, X11 events). It contains an event handling callback and a rendering callback.

The program class is exposed to an OpenGL rendering context for visualization, as well as a number of utility classes that intuitively wrap boilerplate OpenGL (taken from TinyEngine ).

By defining a derived class with specialized callbacks (and any additional desired members), arbitrary behavior can be achieved using the data piped in, on the "windowless" OpenGL window.

The derived classes are precompiled and placed into ~/.config/splash/exec where they are found and linked by splash at run time.

You can build your own visualization programs by defining a custom derived class, compiling it and placing it in the exec folder. Check out the program folder for examples (as well as the makefile).

Interesting Reads:

https://www.linuxjournal.com/article/3687

https://www.tldp.org/HOWTO/html_single/C++-dlopen/

https://stackoverflow.com/questions/20443560/how-to-practically-ship-glsl-shaders-with-your-c-software

https://stackoverflow.com/questions/4052940/how-to-make-an-opengl-rendering-context-with-transparent-background

If there is a desire for more detailed information on how to build a custom visualization, I can update the Wiki (if I get requests).

Notes

To-Do

  • Proper configuration file system, to expose the programs to static user settings
  • More well tested execution modes
    • Plotting methods
    • .obj file load and display
    • Particle system

Why?

¯_(ツ)_/¯

check out my dope desktop fidget spinner, man

splash fidget

A terrible Idea

One could theoretically add a whole DearImGUI menu to your desktop using splash. Why? I don't know. But it's possible. Everyday I stray further from the light.

Contributing

If you find this interesting and would like to contribute that would be awesome. A number of places where contributing would be nice:

  • Designing use cases for different execution modes
  • Testing portability for other window managers / desktop environments

License

MIT License

splash's People

Contributors

b3nj5m1n avatar weigert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

splash's Issues

"GLSL 1.30 is not supported" at runtime?

Hi, I'm getting this error log at runtime:

Linker Error: 0:3(10): error: GLSL 1.30 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES

It hangs up for a moment, prints this two times then quits, if that helps with debugging.

Splash was compiled successfully without any errors, after I fulfilled the compilation dependencies.

I'm on a Thinkpad x201 running Arch Linux too (btw) and glslang v. 8.13.3743-1 is installed, if that helps too.

Missing LICENSE

I see you have no LICENSE file for this project.

I would suggest adding a LICENSE file so that others quickly see that the project has the MIT license.

I can make a PR for this if you would like.

Display usually windowed content on desktop?

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.

Support for X class name

As far as I can tell, the splash window doesn't have a class name, nor an instance name.

You can check that using the tool xprop. It should set a class name (Like SPLASH) by default. This would address the issue of having to do manual work in bspwm (And I imagine other tiling wm's) to get the node into floating mode. Here is a code snippet you could put into your bspwmrc to automatically set the node to floating on startup, provided it has the class & instance name "SPLASH":

bspc rule -a SPLASH:SPLASH state=floating

This would also make it very easy to exclude splash from shadows/blurs in compositors such as picom or the picom-tryone fork with support for kawase blur. (Currently, if you have kawase enabled and start splash, the whole screen will be blurred).

Not working in i3

I am running i3. I run splash fidget --a and nothing showed up. My background is a little dark, so I ran xsetroot -solid white and I still could not see anything show up when I ran splash fidget --a

Not working on archlinux

I saw your post on r/unixporn and it looks great.
If I build it from source I get this error:

In file included from splash.cpp:1: splash.h:6:10: fatal error: boost/filesystem/operations.hpp: No such file or directory 6 | #include <boost/filesystem/operations.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:7: splash] Error 1

archlinux does not have boost_system and boost_filesystem as packages, I do have boost-libs installed though

Thank you in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.