diff --git a/shell.nix b/shell.nix index 4938f24..36919d2 100644 --- a/shell.nix +++ b/shell.nix @@ -12,34 +12,31 @@ pkgs.mkShell { shellHook = '' STIME=5 - programs=("cbonsai" "cmatrix" "nyancat" "fortuneCow") + programs="cmatrix cbonsai nyancat fortuneCow" + trap 'stty sane; tput cnorm; clear' EXIT + while true; do - choice=$(shuf -n 1 -e "cbonsai" "cmatrix" "nyancat" "fortuneCow") + choice=$(echo "$programs" | tr ' ' '\n' | shuf -n 1) clear tput sgr0 case "$choice" in cbonsai) - timeout "$STIME" cbonsai -t .2 -l - reset - clear + cbonsai -t .2 + sleep "$STIME" ;; cmatrix) - timeout "$STIME" cmatrix - reset - clear + bash -c "cmatrix -u 4 & pid=\$!; sleep $STIME; kill -INT \$pid; wait \$pid" ;; nyancat) timeout "$STIME" nyancat - reset - clear ;; fortuneCow) fortune | cowsay sleep "$STIME" - clear ;; esac + sleep 1 done ''; }