diff --git a/README.md b/README.md index 06b0200..605eec3 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,9 @@ set -g @floax-bind '-n M-p' # Setting the main key to toggle the floating pane on and off set -g @floax-bind '' +# Setting the prefix key for quick actions in the floating pane (zoom in, zoom out, reset, lock, unlock, etc) +set -g @floax-prefix 'C-M' + # When the pane is toggled, using this bind pops a menu with additional options # such as resize, fullscreen, resetting to defaults and more. set -g @floax-bind-menu 'P' diff --git a/floax.tmux b/floax.tmux index 0475c50..00439aa 100755 --- a/floax.tmux +++ b/floax.tmux @@ -15,7 +15,8 @@ tmux setenv -g FLOAX_Y "$(tmux_option_or_fallback '@floax-y' 'C')" tmux setenv -g FLOAX_BORDER_COLOR "$(tmux_option_or_fallback '@floax-border-color' 'magenta')" tmux setenv -g FLOAX_TEXT_COLOR "$(tmux_option_or_fallback '@floax-text-color' 'blue')" tmux setenv -g FLOAX_TITLE "$(tmux_option_or_fallback '@floax-title' "${DEFAULT_TITLE}")" -tmux setenv -g FLOAX_CHANGE_PATH "$(tmux_option_or_fallback '@floax-change-path' 'true')" +tmux setenv -g FLOAX_CHANGE_PATH "$(tmux_option_or_fallback '@floax-change-path' 'true')" +tmux setenv -g FLOAX_PREFIX "$(tmux_option_or_fallback '@floax-prefix' 'C')" tmux setenv -g FLOAX_SESSION_NAME "$(tmux_option_or_fallback '@floax-session-name' "${DEFAULT_SESSION_NAME}")" eval "$(tmux showenv -s)" diff --git a/scripts/utils.sh b/scripts/utils.sh index 6bd3b49..bce2547 100755 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -19,29 +19,30 @@ FLOAX_BORDER_COLOR=$(envvar_value FLOAX_BORDER_COLOR) FLOAX_TEXT_COLOR=$(envvar_value FLOAX_TEXT_COLOR) CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" FLOAX_CHANGE_PATH=$(envvar_value FLOAX_CHANGE_PATH) +FLOAX_PREFIX=$(envvar_value FLOAX_PREFIX) FLOAX_TITLE=$(envvar_value FLOAX_TITLE) -DEFAULT_TITLE='FloaX: C-M-s 󰘕  C-M-b 󰁌  C-M-f 󰊓  C-M-r 󰑓  C-M-e 󱂬  C-M-d ' +DEFAULT_TITLE="FloaX: ${FLOAX_PREFIX}-s 󰘕  ${FLOAX_PREFIX}-b 󰁌  ${FLOAX_PREFIX}-f 󰊓  ${FLOAX_PREFIX}-r 󰑓  ${FLOAX_PREFIX}-e 󱂬  ${FLOAX_PREFIX}-d " FLOAX_SESSION_NAME=$(envvar_value FLOAX_SESSION_NAME) DEFAULT_SESSION_NAME='scratch' set_bindings() { - tmux bind -n C-M-s run "$CURRENT_DIR/zoom-options.sh in" - tmux bind -n c-M-b run "$CURRENT_DIR/zoom-options.sh out" - tmux bind -n C-M-f run "$CURRENT_DIR/zoom-options.sh full" - tmux bind -n C-M-r run "$CURRENT_DIR/zoom-options.sh reset" - tmux bind -n C-M-e run "$CURRENT_DIR/embed.sh embed" - tmux bind -n C-M-d run "$CURRENT_DIR/zoom-options.sh lock" - tmux bind -n C-M-u run "$CURRENT_DIR/zoom-options.sh unlock" + tmux bind -n "${FLOAX_PREFIX}-s" run "$CURRENT_DIR/zoom-options.sh in" + tmux bind -n "${FLOAX_PREFIX}-b" run "$CURRENT_DIR/zoom-options.sh out" + tmux bind -n "${FLOAX_PREFIX}-f" run "$CURRENT_DIR/zoom-options.sh full" + tmux bind -n "${FLOAX_PREFIX}-r" run "$CURRENT_DIR/zoom-options.sh reset" + tmux bind -n "${FLOAX_PREFIX}-e" run "$CURRENT_DIR/embed.sh embed" + tmux bind -n "${FLOAX_PREFIX}-d" run "$CURRENT_DIR/zoom-options.sh lock" + tmux bind -n "${FLOAX_PREFIX}-u" run "$CURRENT_DIR/zoom-options.sh unlock" } unset_bindings() { - tmux unbind -n C-M-s - tmux unbind -n C-M-b - tmux unbind -n C-M-f - tmux unbind -n C-M-r - tmux unbind -n C-M-e - tmux unbind -n C-M-d - tmux unbind -n C-M-u + tmux unbind -n "${FLOAX_PREFIX}-s" + tmux unbind -n "${FLOAX_PREFIX}-b" + tmux unbind -n "${FLOAX_PREFIX}-f" + tmux unbind -n "${FLOAX_PREFIX}-r" + tmux unbind -n "${FLOAX_PREFIX}-e" + tmux unbind -n "${FLOAX_PREFIX}-d" + tmux unbind -n "${FLOAX_PREFIX}-u" } tmux_version() { diff --git a/scripts/zoom-options.sh b/scripts/zoom-options.sh index 7d5b5a0..4b25aa1 100755 --- a/scripts/zoom-options.sh +++ b/scripts/zoom-options.sh @@ -41,8 +41,8 @@ unlock_bindings() { lock_bindings() { unset_bindings - tmux bind -n C-M-u run "$CURRENT_DIR/zoom-options.sh unlock" - change_popup_title "Bindings locked. Unlock with [Ctrl-Alt-u]" + tmux bind -n "${FLOAX_PREFIX}-u" run "$CURRENT_DIR/zoom-options.sh unlock" + change_popup_title "Bindings locked. Unlock with [${FLOAX_PREFIX}-u]" } change_popup_title() {