Skip to content

Instantly share code, notes, and snippets.

@LintaoAmons
Created October 8, 2022 09:50
Show Gist options
  • Save LintaoAmons/22f6184b26bd5b93d8fe9f9276f50f75 to your computer and use it in GitHub Desktop.
Save LintaoAmons/22f6184b26bd5b93d8fe9f9276f50f75 to your computer and use it in GitHub Desktop.
Popup terminal with tmux
# ... your other config
bind-key -n M-3 run-shell 'toggle-tmux-popup'
# you can switch `M-3` to any keybindings you like.
#!/bin/bash
# 👻 put this file into your $PATH, normally `~/.local/bin/toggle-tmux-popup`
# 👻 this script should have runable permission.
if [ "$(tmux display-message -p -F "#{session_name}")" = "popup" ];then
tmux detach-client
else
tmux popup -d '#{pane_current_path}' -xC -yC -w80% -h75% -E "tmux attach -t popup || tmux new -s popup"
fi
@JackTheMico
Copy link

Pop-up windows based on the current directory name.

bind-key -n M-g if-shell -F '#{==:#{session_name},#{b:pane_current_path}}' {
    detach-client
} {
    display-popup -d "#{pane_current_path}" -xC -yC -w 90% -h 85% -E 'tmux new-session -A -s (tmux display-message -p "#{b:pane_current_path}")'
}

@gogongxt
Copy link

I found that popup tmux session cannot share clipboard in copy-mode-vi.
Does someone know what the problem and how to solve it?

@q962
Copy link

q962 commented Aug 18, 2025

bind-key -T copy-mode-vi y                 send-keys -X copy-pipe 'tmux save-buffer - | wl-copy'

@bfrg
Copy link

bfrg commented Aug 18, 2025

@gogongxt It works fine on my machine. I have the following in my .tmux.conf:

# Be more like Vim in copy-mode-vi
bind-key -T copy-mode-vi y send-keys -X copy-pipe 'xclip -i -selection clipboard'
bind-key -T copy-mode-vi Y send-keys -X copy-pipe-end-of-line 'xclip -i -selection clipboard'
bind-key -T copy-mode-vi v if-shell -F '#{selection_active}' { send-keys -X clear-selection } { send-keys -X begin-selection }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment