Skip to content

Instantly share code, notes, and snippets.

@febriliankr
Created May 23, 2024 04:57
Show Gist options
  • Save febriliankr/c318b1fb54c13c3d340b7e10d322d9ae to your computer and use it in GitHub Desktop.
Save febriliankr/c318b1fb54c13c3d340b7e10d322d9ae to your computer and use it in GitHub Desktop.
# open popup session in the current path, so single key can open or close popup with ease
bind-key -n M-u if-shell -F '#{==:#{session_name},scratch}' {
# Detach the client if the current session is "scratch"
detach-client
} {
# Check if a popup is already open to prevent multiple popups
if-shell '[ -n "#{popup_pid}" ]' {
display-message "Popup already open"
} {
# Capture the current path and display a popup to open or attach to "scratch" session
display-popup -E -w 90% -h 90% -x C -y C "tmux new-session -A -s scratch -c '#{pane_current_path}'"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment