Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @fpp-history-limit setting #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ bind-key x run-shell '~/.tmux/plugins/tmux-fpp/fpp.tmux start paste'

Put `set -g @fpp-path '~/my/path/fpp'` in `tmux.conf`.

> How can I make fpp search my pane history and not just the current screen?

Put `set -g @fpp-history-limit '50000'` in `tmux.conf`.

### Other goodies

`tmux-fpp` works great with:
Expand Down
19 changes: 18 additions & 1 deletion fpp.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ set -Eeu -o pipefail
# @fpp-path
# - Custom path to FPP.
# - Default to 'fpp'.
# @fpp-history-limit
# - Whether to only use the current screen as input, or the whole pane
# history.
# - Defaults to 'screen'.
#
# This script has several entry points. With no arguments, it defaults to 'init'.
# The entrypoints are defined by functions prefixed with `tmux_fpp_…`:
Expand Down Expand Up @@ -88,8 +92,21 @@ tmux_fpp_start() {
# Otherwise, it's cleaned up in the "run" invocation after piping to fpp.
trap 'rm -f "${tmpfile}"' ERR RETURN

# @fpp-history-limit determines if only the current screen is used as input,
# or the scrollback history of the pane is also used.
# Defaults to 'screen'.
fpp_history_limit="$(tmux show-option -gqv @fpp-history-limit)" || true
: "${fpp_history_limit:=screen}"

# Capture the pane contents.
if [ "$fpp_history_limit" = "screen" ]; then
content="$(tmux capture-pane -Jp)"
else
content="$(tmux capture-pane -JpS -"$fpp_history_limit")"
fi

# Save the pane contents to the temporary file.
tmux capture-pane -Jp > "${tmpfile}"
echo "$content" > "${tmpfile}"

# Create a new window, running the "tmux_fpp_internal_run" function.
# It will run fpp and clean up the temp file.
Expand Down