-
Notifications
You must be signed in to change notification settings - Fork 0
/
sstui
20 lines (15 loc) · 810 Bytes
/
sstui
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
case "$(uname -a)" in
*Darwin*) UEBERZUG_TMP_DIR="$TMPDIR" ;;
*) UEBERZUG_TMP_DIR="/tmp" ;;
esac
cleanup() {
ueberzugpp cmd -s "$SOCKET" -a exit
}
trap cleanup HUP INT QUIT TERM EXIT
UB_PID_FILE="$UEBERZUG_TMP_DIR/.$(uuidgen)"
ueberzugpp layer --no-stdin --silent --use-escape-codes --pid-file "$UB_PID_FILE"
UB_PID=$(cat "$UB_PID_FILE")
export SOCKET="$UEBERZUG_TMP_DIR"/ueberzugpp-"$UB_PID".socket
sscli -c "$@" | fzf --reverse --preview="sh -c 'curl -s 'https://oa.cc.iitk.ac.in/Oa/Jsp/Photo/\$(echo {} | cut -d ',' -f 2 | xargs)_0.jpg' --output /tmp/a.jpg && ueberzugpp cmd -s $SOCKET -i fzfpreview -a add -x \$FZF_PREVIEW_LEFT -y \$FZF_PREVIEW_TOP --max-width \$FZF_PREVIEW_COLUMNS --max-height \$FZF_PREVIEW_LINES -f /tmp/a.jpg '"
ueberzugpp cmd -s "$SOCKET" -a exit