mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-25 13:42:23 +00:00
add meme-maker
This commit is contained in:
parent
9808fa568f
commit
8a90eafdc7
2 changed files with 37 additions and 1 deletions
|
@ -7,7 +7,7 @@ GEN_SCRIPT_DATA_PATH="/home/leon/copy-pasta"
|
||||||
|
|
||||||
|
|
||||||
#options=$(for x in $GEN_SCRIPT_DATA_PATH/*; do echo "$x" | sed "s|$GEN_SCRIPT_DATA_PATH/||g"; done)
|
#options=$(for x in $GEN_SCRIPT_DATA_PATH/*; do echo "$x" | sed "s|$GEN_SCRIPT_DATA_PATH/||g"; done)
|
||||||
options=$(find "$GEN_SCRIPT_DATA_PATH" -type f | grep --invert-match ".git" | sed "s|$GEN_SCRIPT_DATA_PATH/||g")
|
options=$(find "$GEN_SCRIPT_DATA_PATH" -type f | grep --invert-match ".git\|meme-maker" | sed "s|$GEN_SCRIPT_DATA_PATH/||g")
|
||||||
choice="$(echo "$options" | rofi -dmenu -matching glob)"
|
choice="$(echo "$options" | rofi -dmenu -matching glob)"
|
||||||
file="$GEN_SCRIPT_DATA_PATH/$choice"
|
file="$GEN_SCRIPT_DATA_PATH/$choice"
|
||||||
|
|
||||||
|
|
36
files/scripts/memeaker
Executable file
36
files/scripts/memeaker
Executable file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh -x
|
||||||
|
# top text
|
||||||
|
#
|
||||||
|
# bottom text
|
||||||
|
|
||||||
|
dir=/home/leon/copy-pasta/meme-maker
|
||||||
|
c=${XDG_CACHE_HOME:=$HOME/.cache}/meme.png
|
||||||
|
|
||||||
|
# template
|
||||||
|
file=$(ls "$dir" | rofi -dmenu -p file)
|
||||||
|
[ -f "$dir/$file" ] || exit 1
|
||||||
|
|
||||||
|
# TOP TEXT
|
||||||
|
top=$(:| rofi -dmenu -p top | sed "s/'/\\\\\\\\\\\\'/g")
|
||||||
|
# BOTTOM TEXT
|
||||||
|
bottom=$(:| rofi -dmenu -p bottom | sed "s/'/\\\\\\\\\\\\'/g")
|
||||||
|
[ "$bottom$top" ] || exit 1
|
||||||
|
|
||||||
|
# prevent repetition of a stupidly long line
|
||||||
|
a=':x=(w-text_w)/2:fontcolor=white:bordercolor=black:borderw=3'
|
||||||
|
b=':fontsize=30'
|
||||||
|
case $file in
|
||||||
|
grave)
|
||||||
|
a=${a%?}0
|
||||||
|
ffmpeg -y -loglevel error -i "$dir/$file" \
|
||||||
|
-vf "drawtext=font=Comic Sans MS:text=$top:y=350$a:fontsize=80, drawtext='font=Comic Sans MS:text=$bottom':y=660$a:fontsize=50" \
|
||||||
|
"$c";;
|
||||||
|
*)
|
||||||
|
# draw the top/bottom text with ffmpeg (no likey imagemagick)
|
||||||
|
ffmpeg -y -loglevel error -i "$dir/$file" \
|
||||||
|
-vf "drawtext=text=$top:y=30$a$b, drawtext=text=$bottom:y=h-60$a$b" \
|
||||||
|
"$c"
|
||||||
|
esac
|
||||||
|
|
||||||
|
# copy to clipboard
|
||||||
|
xclip -sel clip -t image/png "$c"
|
Loading…
Reference in a new issue