Files
dotfiles/local/bin/news
Uttarayan Mondal 2e750ef16d Added newsboat
Update init.vim
2021-05-05 12:45:03 +05:30

60 lines
1017 B
Bash
Executable File

#!/usr/bin/env bash
PID=$$
export ID=$PID
DIR=/tmp/ueberzug_$PID
export UFIFO=$DIR/ufifo
# MAX_COLUMNS=60
IMAGE=$1
function cleanup {
# remove_image
stop_ueberzug
if [ -d "$DIR" ];then
rm -r $DIR
fi
exit
}
if [ ! -d "$DIR" ];then
mkdir $DIR
fi
source $(ueberzug library)
function start_ueberzug {
mkfifo $UFIFO
ImageLayer --silent <"$UFIFO" &
exec 3>"$UFIFO"
}
function stop_ueberzug {
exec 3>&-
rm $UFIFO &> /dev/null
}
# function set_image {
# x_size=$(tput cols)
# y_size=$(tput lines)
# MAX_COLUMNS=$(($x_size/5))
# x=$(($x_size-$MAX_COLUMNS-5))
# y=$(($y_size-5))
# echo $x $y
# ImageLayer::add [identifier]="$ID" [x]="${x}" [y]="${y}" \
# [max_width]="${MAX_COLUMNS}" \
# [path]="$@" \
# >"$UFIFO"
# }
# function remove_image {
# ImageLayer::remove [identifier]="$ID" \
# >"$UFIFO"
# }
trap cleanup EXIT
start_ueberzug
newsboat
cleanup