@@ -82,7 +82,7 @@ prepare_init() {
8282
8383declare name id id_format toggle_keys=() init_args=() display_args=()
8484declare on_init before_open after_close toggle_mode socket_name socket_path
85- declare default_shell popup_caller opened_name current_pane_id
85+ declare popup_caller opened_name current_pane_id
8686main () {
8787 # Load internal variables
8888 popup_caller=${__tmux_popup_caller} # content: {pane_id}:$TMUX
@@ -104,7 +104,6 @@ main() {
104104 toggle_mode=" #{@popup-toggle-mode}" \
105105 socket_name=" #{@popup-socket-name}" \
106106 socket_path=" #{@popup-socket-path}" \
107- default_shell=" #{default-shell}" \
108107 current_pane_id=" #{pane_id}" \
109108 " ${batch_expand_args[@]} "
110109
@@ -192,31 +191,23 @@ main() {
192191
193192 # Command sequence to open the popup window, including hooks.
194193 open_cmds=()
195- # Script to initialize the popup session inside a popup window.
196- open_script=" "
197194
198195 # Handle hook: before-open
199196 if check_hook " $before_open " ; then open_cmds+=(run -C " $before_open " \; ); fi
200197
201- # Starting from version 3.5, tmux uses the user's `default-shell` to execute
202- # shell commands. However, our scripts require sh(1) and may not be parsed
203- # correctly by some incompatible shells. In this case, we change the default
204- # shell to `/bin/sh` and then revert it immediately.
205- open_script+=" tmux set default-shell '$default_shell ';"
206- open_cmds+=(set default-shell " /bin/sh" \; )
207-
208- # Set $TMUX_POPUP_SERVER to identify the popup server.
209- open_script+=" export TMUX_POPUP_SERVER='$popup_server ' SHELL='$default_shell ';"
210-
211- # Suppress stdout to hide the `[detached] ...` message
212- open_script+=" exec $( escape tmux " ${popup_socket[@]} " " ${init_cmds[@]} " ) >/dev/null;"
213- open_cmds+=(display-popup " ${display_args[@]} " " $open_script " \; )
198+ # Add commands that actually open the popup.
199+ open_cmds+=(
200+ display-popup " ${display_args[@]} "
201+ -e TMUX_POPUP_SERVER=" $popup_server " # used to identify the popup server
202+ /bin/sh -c
203+ " exec $( escape tmux " ${popup_socket[@]} " " ${init_cmds[@]} " ) >/dev/null"
204+ \;
205+ )
214206
215207 # Handle hook: after-close
216208 if check_hook " $after_close " ; then open_cmds+=(run -C " $after_close " \; ); fi
217209
218- # Do open the popup window
219- # printf '%s\n'
210+ # Do open the popup window.
220211 tmux " ${open_cmds[@]} "
221212
222213 # Undo temporary changes on the popup server
0 commit comments