40 lines
1.2 KiB
Bash
Executable File
40 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
$cecho = '/gmgauthier/.local/bin/cecho';
|
|
|
|
function border () {
|
|
local str="$*" # Put all arguments into single string
|
|
local len=${#str}
|
|
local i
|
|
for ((i = 0; i < len + 4; ++i)); do
|
|
printf '-'
|
|
done
|
|
printf '\n| %s |\n' "$str"
|
|
for ((i = 0; i < len + 4; ++i)); do
|
|
printf '-'
|
|
done
|
|
echo
|
|
}
|
|
|
|
clear
|
|
border "Internet Video Console"
|
|
echo
|
|
read -p "Search For: " searchphrase
|
|
|
|
ytfzf --detach --notify-playing --ytdl-pref="[height <=? 720]" --sort-by="upload_date" --pages=3 "${searchphrase}"
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
/home/gmgauthier/.local/bin/cecho "IYellow" "There are no results for '${searchphrase}'";
|
|
read -p "Press any key to exit... " -n1 -s
|
|
else
|
|
# needed because immediate exit was destroying the handshake between alacritty and ytfzf
|
|
/home/gmgauthier/.local/bin/cecho "Green" "Your video will play momentarily..."
|
|
sleep 4
|
|
#This only works if the query window is the only open terminal
|
|
#xdotool search --onlyvisible --classname alacritty windowminimize
|
|
#sleep 5
|
|
#this only works if mpv doesn't become the active window
|
|
#xdotool windowminimize getactivewindow
|
|
fi
|
|
exit 0
|