I made some screensavers that you can have run after a period of inactivity in your terminal. I'm using bevy to generate frames and then ratatui/ratatui-image, through my plugin bevy_ratatui_render (https://github.com/cxreiff/bevy_ratatui_render), to render those frames. The period of inactivity part only works in ZSH because I'm using the TMOUT env variable– please let me know if you know another way!
GNU screen has a `lockscreen` option with a $LOCKPRG environment variable, and an `idle` command that can do `idle 300 lockscreen`.
tmux has `lock-command` / `lock-after-time`.
You could implement a screensaver on top of those... they only "lock" as much the $LOCKPRG / lock-command chooses to lock them, no reason a single keypress can't "unlock" the screen if it's just a screensaver.
Those will be invoked regardless of whether a program is running or it's sitting at the prompt. Since tmux and screen are terminal emulators, the underlying shell and programs running in them won't even be aware of the screen saver.
I have my friend's garage NAS set to use `cmatrix` as a lockscreen on the system console and mine uses `glances`.
I am personally using https://github.com/st3w/neo (from the Matrix) as my screensaver. Feels good to feel yourself looking at that side of the world from time to time :)
This is great, I've been wanting to do something like this after finding an old series about making games in the terminal (https://www.youtube.com/watch?v=xW8skO7MFYw). I'll need to checkout bevy now.
Bevy lets you create a custom render pipeline, so you just have to get the rendered image and send it to ratatui instead of a window. I handled that part in bevy_ratatui_render (https://github.com/cxreiff/bevy_ratatui_render) which just gives you a bevy Camera and a ratatui Widget that draws the latest frame.
That would be cool! But this is a fairly different/incompatible approach- here each frame is generated by the GPU using an actual game engine (bevy) and then printed to the terminal instead of a window- no logic for different types of characters. Maybe in the future if I replace the ascii rendering library.
cxreiff|1 year ago
oxygen_crisis|1 year ago
tmux has `lock-command` / `lock-after-time`.
You could implement a screensaver on top of those... they only "lock" as much the $LOCKPRG / lock-command chooses to lock them, no reason a single keypress can't "unlock" the screen if it's just a screensaver.
Those will be invoked regardless of whether a program is running or it's sitting at the prompt. Since tmux and screen are terminal emulators, the underlying shell and programs running in them won't even be aware of the screen saver.
I have my friend's garage NAS set to use `cmatrix` as a lockscreen on the system console and mine uses `glances`.
alkh|1 year ago
jcusch|1 year ago
unknown|1 year ago
[deleted]
LarsDu88|1 year ago
cxreiff|1 year ago
wutwutwat|1 year ago
nusl|1 year ago
sans_souse|1 year ago
I would personally like to see a set of screensavers that utilizes terminal-text-effects
cxreiff|1 year ago
That would be cool! But this is a fairly different/incompatible approach- here each frame is generated by the GPU using an actual game engine (bevy) and then printed to the terminal instead of a window- no logic for different types of characters. Maybe in the future if I replace the ascii rendering library.