GithubHelp home page GithubHelp logo

m4444 / tmatrix Goto Github PK

View Code? Open in Web Editor NEW
375.0 10.0 14.0 8.76 MB

Terminal based replica of the digital rain from The Matrix.

License: GNU General Public License v2.0

C++ 88.04% CMake 3.33% Roff 4.62% Shell 4.01%
matrix digital rain terminal-based tmatrix ncurses

tmatrix's Introduction

TMatrix

[Latest GitHub release] [License]

Codacy Badge Language grade: C/C++

TMatrix is a program that simulates the digital rain from The Matrix. It's focused on being the most accurate replica of the digital rain effect achievable on a typical terminal, while also being customizable and performant.

Installation

Packaging status

Install on Arch Linux AUR votes

Install tmatrix-git from the AUR. For example, with an AUR helper such as yay:

yay -S tmatrix-git

Install on Gentoo Linux

eselect repository enable bright
emerge --ask tmatrix

Install on any Nix system

nix-env -f '<nixpkgs>' -iA tmatrix

Install on openSUSE Linux

The package can be installed from the community repo:

Note: if you are using Leap insted of Tubleweed uncomment your version of Leap and delete the others.

DISTRIBUTION=Tumbleweed
#DISTRIBUTION=Leap_15.5
#DISTRIBUTION=Leap_15.4

zypper addrepo "https://download.opensuse.org/repositories/home:kosmonaut2001/openSUSE_${DISTRIBUTION}/home:kosmonaut2000.repo"
zypper refresh
zypper install TMatrix

Download and install on other GNU/Linux distributions

The prebuilt TMatrix uses version 5 of the ncurses library. To install the library on Ubuntu or Debian run:

sudo apt-get install libncurses5

Now that you have the required library you can install and run tmatrix:

wget -q https://github.com/M4444/TMatrix/releases/download/v1.4/installation.tar.gz
tar -zxvf installation.tar.gz
cd installation
sudo ./install.sh

To check if it installed correctly run:

tmatrix --version

Uninstall

sudo rm -f /usr/bin/tmatrix \
           /usr/share/man/man6/tmatrix.6.gz \
           /usr/share/bash-completion/completions/tmatrix \
           /usr/share/zsh/site-functions/_tmatrix

To check if anything was left behind you can run:

locate tmatrix

Build and install from source

Tools

This project uses C++17 so you'll need the latest tools in order you build it:

Library

Commands

git clone https://github.com/M4444/TMatrix.git
cd TMatrix
mkdir -p build && cd build
cmake ..
make -j8
sudo make install

Info

Options

TMatrix is very customizable. You can change the starting title text, the color of the background and the characters, the speed, length and separations of the rain streaks. During execution you can use p to pause and q to quit.

For a full description of all the options run man tmatrix or tmatrix --help.

Contributing

Suggestions, bug reports and patch submissions are all welcome. You can create an issue, send a pull requests of just send an email. For details see CONTRIBUTING.md.

Author

Written and maintained by Miloš Stojanović ([email protected]).

Acknowledgments

Thanks to:

  • Infinisil for creating a Nix package
  • filalex77 for creating a Gentoo Linux package, adding bash, zsh and tcsh completions scripts and a .editorconfig file
  • eliasrg for creating and maintaining the Arch Linux package, clarifying the installation options on Arch Linux, adding CMake install commands for the man page and helping in the creation of completions scripts
  • Makefile-dot-in for fixing a problem linking atomic on Android
  • sebpardo for pointing out a typo in the man page
  • fosspill for correcting the name of the required ncurses library
  • meskarune for the idea and helpful suggestions for creating the 'fade' and 'rainbow' options
  • taschenlampe for creating a openSUSE Linux package and reporting an issue with the install script

License

TMatrix is licensed under the GPL-2.0-only - see the LICENSE file for details.

Donations

If you wish to send a donation you can do so here Liberapay or here PayPal.

How it looks

tmatrix's People

Contributors

br1ght0ne avatar eliasrg avatar m4444 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tmatrix's Issues

Color Gradient Feature Request

It would be nice if the code lines had a color gradient going from black to bright greenish/white similar to the matrix revolution movie. Here are screenshots from the actual movie: https://imgur.com/a/cXHwLSN

There is a music visualizer that lets people set color steps: https://github.com/dpayne/cli-visualizer

I have no idea if this feature is desired or difficult to implement so its cool if you decide not to do it.

I always thought the matrix reloaded style looked a lot cooler than the original matrix code rain and no one has made an implementation as far as I know.


Edit by @M4444: Creating subtasks:

  • Fading characters

  • Rainbow code

Typo in man page regarding background color

The man page incorrectly indicates the -C argument for changing both letter and background color when changing the background color should be -c, see line 78:

TMatrix/tmatrix.6

Lines 6 to 12 in 223fb2c

\fItmatrix\fR [--version] [--help] [--mode=<mode>]
[-s<value>|--steps-per-sec=<value>]
[-f<min>,<max>|--fall-speed=<min>,<max>]
[-G<min>,<max>|--start-gap=<min>,<max>]
[-g<min>,<max>|--gap=<min>,<max>] [-l<min>,<max>]
[-r<min>,<max>] [-C<color> | --color=<color>]
[-c<color> | --bakcground=<color>] [-t<text> | --title=<text>]

TMatrix/tmatrix.6

Lines 69 to 79 in 223fb2c

\-C, --color=<color>
Set the color of the Matrix characters.
.br
Available colors: \fBdefault\fR, \fBwhite\fR, \fBgray\fR, \fBblack\fR, \fBred\fR, \fBgreen\fR,
.br
\fByellow\fR, \fBblue\fR, \fBmagenta\fR, \fBcyan\fR.
.br
Default: \fIgreen\fR.
.TP 4
\-C, --background=<color>
Set the color of the background.

/usr/share/zsh/site-functions//_tmatrix

Running a ubuntu-based system:

sudo ./install.sh
[sudo] Password for user:
install: regular file '/usr/share/zsh/site-functions//_tmatrix' cannot be created: File or directory not found
-> note the //

In install.sh I found
ZSH_COMPLETION_DIR="$INSTALL_PREFIX/share/zsh/site-functions/"
Solved by removing the ending "/" + creating the missing dir ; install runs after these little steps-

More Authentic Experience - Custom Font

Hey I stumbled upon this project after not being satisfied with the accuracy of cmatrix, I just got into linux and back into programming about 5 months ago and I would like to contribute some accurate aesthetic to this projects already extensible and simple code.

My first feature request would be to add a custom font file (to the default if at all possible) that is an exact font image of the one used in the movies. I recognize the amount of work this could be to handle, but in the next couple months I will try to be tackling it head on, making an accurate font image. If I run into any issues It might take a bit seeings how I’m not used to programming in anything but C++, but we will see how this goes.

Most if not all the characters are english/Japanese with mirrored versions every now and then and I feel as if this could be easily done, let me know if you have any ideas or any concerns, Sorry if this sounds a bit weird as this is my first time really using github.

Exec format error.?

been getting this when trying to install on rasberry pi, rapsbian os. I know it's running libncurses6.1 not sure if that's the issue, or what needs to be changed so it can find it.

pi@pi:/installation $ sudo ./install.sh
pi@pi:
/installation $ tmatrix
-bash: /usr/bin/tmatrix: cannot execute binary file: Exec format error

This is the error when trying to compile from source:
CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
Call Stack (most recent call first):
/usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.13/Modules/FindCurses.cmake:245 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:23 (find_package)

Hallo again,

I am also interested in contributing to TMatrix and was wondering if you could guide me on how to modify the source code to implement transparent background support myself. Could you point me to the part of the code that handles background rendering, or any tips on where to start looking?

Any guidance would be greatly appreciated, as I am keen to contribute to the project and potentially submit a pull request once I manage to implement this feature.

Gentoo instructions broken

The current instructions tell to enable repository bright, but the repo is not available in the default list of repositories. eselect repository enable bright fails: repository not in repositories.xml.

Please update the readme to either bring the gentoo instructions up to date or remove the section altogether.

Feature Request: Transparent Background Support

Hello TMatrix developers,

I am enjoying using TMatrix and appreciate the work put into it. I am currently trying to set it up in a way that it integrates seamlessly with my transparent terminal setup. I noticed that there is no option to make the background of TMatrix transparent, and I think this feature would be a great addition.

Having the ability to run TMatrix with a transparent background would allow the digital rain effect to overlay beautifully with the desktop wallpaper or other applications, enhancing the visual experience.

Thank you for considering this feature request.

Best regards,

Sergius

Misplaced v1.3 tag

The tag v1.3currently points to an abandoned commit, which causes the Arch Linux build to classify the current version as 1.2. v1.3 should probably be changed to point to master.

[Request] Take multiline text input

Would be awesome to be able to use something like $ neofetch > tmatrix or $ banner "SAMPLE_TEXT" > tmatrix and have it display in the way that the -t flag works

Add appearing text

When the rain start a title text should appear in the middle after some short time, similar to how it does in the intro to the movie.
Optionally, users can set their own text.

Fails to compile on Android

In Termux running on Android 8.1, compilation fails with the following error:

ata/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: CMakeFiles/tmatrix.dir/src/tmatrix.cpp.o: in function `resizeHandler(int)':
tmatrix.cpp:(.text+0x18): undefined reference to `__atomic_store_1'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: CMakeFiles/tmatrix.dir/src/tmatrix.cpp.o: in function `render(RainProperties const&)':
tmatrix.cpp:(.text+0xf4): undefined reference to `__atomic_load_1'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: tmatrix.cpp:(.text+0x118): undefined reference to `__atomic_store_1'
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/tmatrix.dir/build.make:191: tmatrix] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/tmatrix.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

This is fixed by explicitly linking atomic in CMakeLists.txt.

[Request] Take multiline text input

Would be awesome to be able to use something like
$ neofetch > tmatrix or banner "SAMPLE_TEXT" > tmatrix
and have it display in the way that the -t flag works

Make a screensaver?

Hi! I love this digital rain effect. Best one I've ever seen by far. I've been thinking about how it might be possible to turn this into a screensaver somehow?

Has the creator considered this? Anyone have any ideas how this might be accomplished?

Missing characters (urxvt issue)

Hi, so I installed this and the ncurses5 library from the AUR. However my terminal does not display any of the special characters
2019-05-27-103059_915x1000_scrot

I'm running a patched nerd font with the ncurses5 compat libs from AUR

How to use this on tty (missing characters)

This works perfectly fine on my terminal emulator but it seems many characters can't be shown on tty. I know this isn't this program's issue but do you know a way I could add support for those characters?

Konsole horizontal jittering

tmatrix-konsole

Does not happen in URXVT or Cool Retro Term AppImage.

I am on Debian unstable but was able to reproduce on KDE Neon.

increasing fps also increases rain falling speed

Currently the default value for --steps-per-sec of 10 looks choppy. But when you set it higher, it also raises the rain falling speed, separately from the -fall-speed setting.
At 60 steps you cannot even see the characters properly, because they fall so fast, even if you set -f 0,1.

Custom Character sets

I am surprised by how great TMatrix's output is, the gradient looks amazing, and I think another good feature would be giving more control on which characters are shown.

The idea comes from will8211/unimatrix and the implementation there is actually very simple, there are two command-line parameters, one for predetermined charsets and other for custom characters. I believe even just one of the two strategies would already be a good additioon to TMatrix, and sooner or later I'll probably implement this to some extent even if just for me to use it, so I may be able to send a PR.

The implementation on Unimatrix is pretty simple:

First there's an Object/Hash/etc with the predefined charsets:

char_set = {
    'a': 'qwertyuiopasdfghjklzxcvbnm',
    'A': 'QWERTYUIOPASDFGHJKLZXCVBNM',
    'c': 'абвгдежзиклмнопрстуфхцчшщъыьэюя',
    'C': 'АБВГДЕЖЗИКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ',
    'e': '☺☻✌♡♥❤⚘❀❃❁✼☀✌♫♪☃❄❅❆☕☂★',
    'g': 'αβγδεζηθικλμνξοπρστυφχψως',
    'G': 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ',
    'k': 'ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン',
    'm': 'ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン1234567890'
         '1234567890-=*_+|:<>"-=*_+|:<>"-=*_+|:<>"-=*_+|:<>"',
    'n': '1234567890',
    'o': 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'
         '`-=~!@#$%^&*()_+[]{}|\;\':",./<>?"',
    'p': '',
    'P': '',
    'r': 'mcclllxxxxvvvvviiiiii',
    'R': 'MCCLLLXXXXVVVVVIIIIII',
    's': '-=*_+|:<>"',
    'S': '`-=~!@#$%^&*()_+[]{}|\;\':",./<>?"',
    'u': args.custom_characters}

Then for the charsets option just concatenate the characters for each specified Charset into a Variable with all possible characters. And to make things even simpler, the custom characters passed through the parameter are saved as one of the charsets:

# "-l" option has been used
if args.character_list:
    chars = ''
    for letter in args.character_list:
        try:
            chars += char_set[letter]
        except KeyError:
            print("Letter '%s' does not represent a valid character list."
                  % letter)
            exit()

And just pick a random character from the all-possible-characters variable to display:

@staticmethod
def get_char():
    """
    Returns a random character from the active character set
    """
    return chars[randint(0, chars_len)]

This has the advantage of specifying not only which characters are available but also how common or rare each character is.

I'd probably use a lambda for the "m" charset and maybe using a lambda or something to generate charsets in a cleaner way

In Ruby (which is my go-to language) for instance, I can do stuff like this:

irb(main):019:0> puts ("A".."z").to_a.join.concat (0..9).to_a.join
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz0123456789

So putting that together with my love for hackish stuff, I'd most likely consider taking arguments formatted as something like:

--custom="0..9,A..Z, ,a..z,12345"

...so I could do this kinda madness:

irb(main):009:1* "0..9,A..Z, ,a..z,12345".split(",").map{|i| 
irb(main):010:1*   next i.to_s unless i.match? /^.\.\..$/
irb(main):011:1*   i.split("..").inject{|f,l|(f..l).to_a.join}
irb(main):012:0> }.join
=> "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz12345"

Or the slightly more readable and less quirky:

irb(main):014:0> input = "0..9,A..Z, ,a..z,12345"
irb(main):015:1* input.split(",").map{|item|
irb(main):016:2*   if item.match? /^.\.\..$/
irb(main):017:2*     item.split("..").inject{|first,last|(first..last).to_a.join}
irb(main):018:2*   else
irb(main):019:2*     item.to_s 
irb(main):020:1*   end
irb(main):021:0> }.join
=> "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz12345"

Pretty neat for less than 10 lines of code, if I do say so myself... And I think this covers pretty much everything I might want.

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.