Variabeln für anpassung der Schrift

This commit is contained in:
Lord Of Nuss 2021-11-15 11:00:18 +01:00
parent d6cd114df1
commit df0e8ad678

15
motd.sh
View File

@ -1,6 +1,6 @@
# Fancy waifu motd # Fancy waifu motd
MOTDPATH="$HOME/.motd" # path to motd folder MOTDPATH="$HOME/src/motd" # path to motd folder
CACHEFILE="/tmp/waifu.cache" # to cache waifu state CACHEFILE="/tmp/waifu.cache" # to cache waifu state
RESOLUTION=256 # resolution of waifu RESOLUTION=256 # resolution of waifu
CENTER=true # center motd? CENTER=true # center motd?
@ -9,6 +9,8 @@ UNAMEARG="-sr" # uname arguments
UPTIMEARG="--pretty" # uptime arguments UPTIMEARG="--pretty" # uptime arguments
tput_cols=$(/usr/bin/tput cols) # terminal columns tput_cols=$(/usr/bin/tput cols) # terminal columns
MINTERMWIDTH=200 # minimal width of term, to display motd MINTERMWIDTH=200 # minimal width of term, to display motd
UNAMECOLOR="\033[1;38;5;93m"
UPTIMECOLOR="\033[1;38;5;99m"
WAIFUS=$(($(ls $MOTDPATH/waifus/*.256.png | wc -w) - 1)) # count of waifus WAIFUS=$(($(ls $MOTDPATH/waifus/*.256.png | wc -w) - 1)) # count of waifus
@ -26,24 +28,31 @@ function output() {
1) 1)
/bin/cat $MOTDPATH/motd | $lx /bin/cat $MOTDPATH/motd | $lx
echo "test"
echo -en $UNAMECOLOR
uname $UNAMEARG | $lx uname $UNAMEARG | $lx
echo -en $UPTIMECOLOR
uptime $UPTIMEARG | $lx uptime $UPTIMEARG | $lx
;; ;;
2) 2)
/bin/cat $MOTDPATH/motd | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' /bin/cat $MOTDPATH/motd | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }'
echo -en $UNAMECOLOR
uname $UNAMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' uname $UNAMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }'
echo -en $UPTIMECOLOR
uptime $UPTIMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' uptime $UPTIMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }'
;; ;;
3) 3)
/bin/cat $MOTDPATH/motd | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' | $lx /bin/cat $MOTDPATH/motd | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' | $lx
echo -en $UNAMECOLOR
uname $UNAMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' | $lx uname $UNAMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' | $lx
echo -en $UPTIMECOLOR
uptime $UPTIMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' | $lx uptime $UPTIMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' | $lx
;; ;;
esac esac
}
printf '\033[0m' #reset colors
}
# if [ $tput_cols -gt $MINTERMWIDTH ] # if [ $tput_cols -gt $MINTERMWIDTH ]
# then # then