# if-shell syntax if-shell -F (condition) {execute this block if true} {execute this block if false} # M-f mapping condition: #{==:#{session_name},floating} (current_session_name == floating) if true: detach-client (you will be in floating window, so detach from that) if false: set -gF '@last_session_name' '#S' (set global variable last_session_name) popup -d '#{pane_current_path}' -xC -yC -w70% -h70% -KER 'tmux new -A -s floating' (start popup window) # ! mapping condition: #{==:#{session_name},floating} (current_session_name == floating) if true: break-pane (break out the current pane into a new window) if false: tmux break-pane -s floating -t $(tmux show -gvq '@last_session_name'): (get the pane from session named floating "floating" and put in the last one) # @ mapping > Same as `!` mapping, just that focus does not shift to the broken pane after it moves to new window