2019-02-04 21:40:45 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-03-06 17:04:05 +00:00
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2021-03-07 11:48:32 +00:00
|
|
|
DEFAULT_THUMBS_KEY_OPTIONS=""
|
|
|
|
THUMBS_KEY_OPTIONS="$(tmux show-option -gqv @thumbs-key-options)"
|
|
|
|
THUMBS_KEY_OPTIONS=${THUMBS_KEY_OPTIONS:-$DEFAULT_THUMBS_KEY_OPTIONS}
|
2020-07-29 20:49:18 +00:00
|
|
|
|
2021-03-07 11:48:32 +00:00
|
|
|
DEFAULT_THUMBS_KEY=space
|
2020-07-29 20:49:18 +00:00
|
|
|
THUMBS_KEY="$(tmux show-option -gqv @thumbs-key)"
|
2019-05-02 20:20:33 +00:00
|
|
|
THUMBS_KEY=${THUMBS_KEY:-$DEFAULT_THUMBS_KEY}
|
|
|
|
|
2021-03-07 11:48:32 +00:00
|
|
|
tmux bind-key ${THUMBS_KEY_OPTIONS:+"$THUMBS_KEY_OPTIONS"} ${THUMBS_KEY:+"$THUMBS_KEY"} run-shell -b "${CURRENT_DIR}/tmux-thumbs.sh"
|
2020-03-15 12:04:24 +00:00
|
|
|
|
|
|
|
BINARY="${CURRENT_DIR}/target/release/thumbs"
|
|
|
|
|
|
|
|
if [ ! -f "$BINARY" ]; then
|
2020-06-05 07:42:28 +00:00
|
|
|
tmux split-window "cd ${CURRENT_DIR} && cargo build --release --target-dir=target && echo 'Press any key to continue...' && read -k1"
|
2020-03-15 12:04:24 +00:00
|
|
|
fi
|