Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s5bug/niji
`clear` but it looks cool
https://github.com/s5bug/niji
Last synced: 1 day ago
JSON representation
`clear` but it looks cool
- Host: GitHub
- URL: https://github.com/s5bug/niji
- Owner: s5bug
- Created: 2024-04-24T06:19:49.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-24T06:46:25.000Z (9 months ago)
- Last Synced: 2024-11-10T16:12:39.597Z (about 2 months ago)
- Language: C++
- Size: 5.86 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# niji
clears your terminal screen but rainbow
based on [the old X68000 niji](https://twitter.com/kata68k/status/1782780099148046481)
## building
build via CMake. release mode via `-DCMAKE_BUILD_TYPE=Release`.
if building via MinGW cut the binary size in 4 by `strip`ping it afterward.
## linux when?
currently this functions on Windows by using `ReadConsoleOutputCharacterW` to get the current state of the screen. for a
Linux version, this would have to be replaced with
- DECRQCRA, to retrieve the hash of a character+formatting at a location
- DECSERA, to replace the formatting of a character at a location with known formatting, to crack the character hash
- BSU/DSU (DECSET 2026), to prevent the screen flashes (to mimic `WriteConsoleW`'s single-chunk behavior)Windows Terminal's DECRQCRA is turned off by default, reasonably so as it allows malicious processes to see anything in
the terminal. I believe (but am not sure) that the `kitty` and `alacritty` terminals support both DECRQCRA and
synchronized updates; if I could test them I would add CMake options for choosing the target environment.additionally, the Windows version uses `DwmFlush` to do a small frame wait, rather than deal with the 15ms Windows
scheduler resolution. due to Linux scheduling being higher-resolution, this could probably be replaced with some sort of
sleep.## DECCARA
DECCARA does not support changing colors: it supports a finite subset of SGI commands, of which the only one even
relevant to our cause is text inversion. if there were to be a more "modern" equivalent for DECCARA that could change
the colors of a rectangle in the console, this program could be achieved without any sort of security holes.