Skip to content

Instantly share code, notes, and snippets.

@PixelSergey
Last active September 4, 2022 19:55
Show Gist options
  • Save PixelSergey/dd52a1454ac5365c50ddcba736686633 to your computer and use it in GitHub Desktop.
Save PixelSergey/dd52a1454ac5365c50ddcba736686633 to your computer and use it in GitHub Desktop.
Cowsay screensaver
#!/bin/bash
trap 'tput cnorm; for i in {1..15}; do xdotool key Ctrl+minus; done; clear;' ERR EXIT;
clear;
tput civis;
toilet --gay "$1" | cowsay -n;
for i in {1..15}; do xdotool key Ctrl+plus; done
while true; do
for i in {1..3}; do
tput cup 0 0;
toilet "$1" | cowsay -n;
sleep 0.25;
tput cup 0 0;
toilet --gay "$1" | cowsay -n;
sleep 0.25;
done
sleep 0.5
for ((i=1; i<=${#1}+1; i++)); do
tput cup 0 0;
text=$(echo $1 | cut -c1-$i)
speak=$(printf "%-${#1}s" "$text")
toilet --gay "$speak" | cowsay -n;
sleep 0.05;
done
sleep 0.5
done
#!/bin/bash
trap 'tput cnorm; clear;' ERR EXIT;
clear;
tput civis;
if [ -z "$1" ]; then
A="hands off"
else
A=$1
fi
toilet --gay "$A" | cowsay -n;
while true; do
for i in {1..3}; do
tput cup 0 0;
toilet "$A" | cowsay -n;
sleep 0.25;
tput cup 0 0;
toilet --gay "$A" | cowsay -n;
sleep 0.25;
done
sleep 0.5
for ((i=1; i<=${#A}+1; i++)); do
tput cup 0 0;
text=$(echo $A | cut -c1-$i)
speak=$(printf "%-${#A}s" "$text")
toilet --gay "$speak" | cowsay -n;
sleep 0.05;
done
sleep 0.5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment