Skip to content

Commit

Permalink
Fix issue with re-binding resh
Browse files Browse the repository at this point in the history
  • Loading branch information
curusarn committed Nov 26, 2021
1 parent 5161c03 commit 2799a51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions scripts/reshctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ __resh_nop() {
}

__resh_bind_control_R() {
bindfunc --revert '\C-r' __resh_widget_control_R_compat
if [ "${__RESH_control_R_bind_enabled-0}" != 0 ]; then
echo "RESH SEARCH app Ctrl+R binding is already enabled!"
return 1
# Re-binding is a valid usecase but it shouldn't happen much
# so this is a warning
echo "Re-binding RESH SEARCH app to Ctrl+R ..."
else
# Only save original binding if resh binding was not enabled
__RESH_bindfunc_revert_control_R_bind=$_bindfunc_revert
fi
bindfunc --revert '\C-r' __resh_widget_control_R_compat
__RESH_bindfunc_revert_control_R_bind=$_bindfunc_revert
__RESH_control_R_bind_enabled=1
if [ -n "${BASH_VERSION-}" ]; then
# fuck bash
Expand Down
6 changes: 3 additions & 3 deletions scripts/shellrc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ __resh_set_xdg_home_paths

__resh_run_daemon

[ "$(resh-config --key BindControlR)" = true ] && __resh_bind_control_R

# block for anything we only want to do once per session
# NOTE: nested shells are still the same session
if [ -z "${__RESH_SESSION_ID+x}" ]; then
Expand All @@ -90,7 +92,5 @@ if [ -z "${__RESH_INIT_DONE+x}" ]; then

__resh_reset_variables

[ "$(resh-config --key BindControlR)" = true ] && __resh_bind_control_R

__RESH_INIT_DONE=1
fi
fi

0 comments on commit 2799a51

Please sign in to comment.