Add confirm option for save and restore.#502
Open
izzygomez wants to merge 4 commits intotmux-plugins:masterfrom
Open
Add confirm option for save and restore.#502izzygomez wants to merge 4 commits intotmux-plugins:masterfrom
izzygomez wants to merge 4 commits intotmux-plugins:masterfrom
Conversation
izzygomez
added a commit
to izzygomez/dotfiles
that referenced
this pull request
Mar 14, 2024
*this depends on support for upstream changes that I'm making to plugin here: tmux-plugins/tmux-resurrect#502
The previous line `tmux bind-key "$key" $command` would experience issues if there was whitespace in `$command`. This fixes this. Also does small refactor to save `run-shell` commands into `run_{save,restore}_script` vars. Also makes sure keys are unbounded (run `unbind`) before binding (`bind-key`).
shabaev
reviewed
Mar 25, 2024
| By default save & restore will have no confirmation step when the key bindings are pressed. To change this, add to `.tmux.conf`: | ||
|
|
||
| set -g @resurrect-save-confirm 'on' | ||
| set -g @resurrect-restore-confirm 'on' |
shabaev
reviewed
Mar 25, 2024
| local run_save_script="run-shell \"$CURRENT_DIR/scripts/save.sh\"" | ||
| local command | ||
| if [ "$should_confirm_save" == "on" ]; then | ||
| command="confirm-before -y -p \"$confirm_save_prompt\" \"$run_save_script\"" |
There was a problem hiding this comment.
jfyi - tmux 3.2a-4ubuntu0.2 - -y is unknown option
|
Hello! any updates? |
Author
Hey, I wrote the original PR here & might eventually get around to implementing fixes requested, but this project seems somewhat dead as they haven't accepted any PRs in over a year, so there's no real incentive. |
|
This PR should be accepted. An optional confirmation part is suitable for users. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview of PR
@resurrect-confirm-save&@resurrect-confirm-restoreoptions. These new options make use oftmux'sconfirm-beforecommand (seeman tmux) to ask for confirmation before saving or restoring thetmuxenvironment.offso that current out-of-the-box plugin experience is not changed.Motivation
I found myself accidentally saving & restoring my
tmuxenvironment because of their key binding similarity to other common actions I do (e.g.<Prefix>+sto listtmuxsessions,<Prefix>+rto reload.tmux.conf), so I wanted to add a confirmation step to save & restore actions when using thetmux-resurrectplugin.Screenshots
Example

.tmux.confchanges to use these new optionsConfirmation message for save action

Confirmation message for restore action
