-
Notifications
You must be signed in to change notification settings - Fork 425
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 confirm option for save and restore. #502
base: master
Are you sure you want to change the base?
Add confirm option for save and restore. #502
Conversation
*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`).
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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a typo - ressurect-confirm-...
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jfyi - tmux 3.2a-4ubuntu0.2 - -y
is unknown option
Hello! any updates? |
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. |
Overview of PR
@resurrect-confirm-save
&@resurrect-confirm-restore
options. These new options make use oftmux
'sconfirm-before
command (seeman tmux
) to ask for confirmation before saving or restoring thetmux
environment.off
so that current out-of-the-box plugin experience is not changed.Motivation
I found myself accidentally saving & restoring my
tmux
environment because of their key binding similarity to other common actions I do (e.g.<Prefix>+s
to listtmux
sessions,<Prefix>+r
to reload.tmux.conf
), so I wanted to add a confirmation step to save & restore actions when using thetmux-resurrect
plugin.Screenshots
Example
.tmux.conf
changes to use these new optionsConfirmation message for save action
Confirmation message for restore action