From 09709c2055390ee035347b5c350cbfc5a471af1a Mon Sep 17 00:00:00 2001
From: Gustaf Rydholm <gustaf.rydholm@gmail.com>
Date: Wed, 21 Feb 2024 23:57:00 +0100
Subject: Add toggle floating tmux term

---
 .config/tmux/tmux.conf | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
index 1b72573..8226b39 100644
--- a/.config/tmux/tmux.conf
+++ b/.config/tmux/tmux.conf
@@ -23,7 +23,7 @@ set-option -g status-style bg=#151515,fg=white
 set-option -g automatic-rename on
 set-option -g renumber-windows on
 set-option -g status-left ""
-set -ga status-left '#[bg=#151515]#[fg=white] #{?window_zoomed_flag,, }'
+set -ga status-left '#[bg=#151515]#[fg=white] #{?window_zoomed_flag,, }'
 set-option -g status-right ""
 set-option -g window-status-format " #[fg=#E1E1E1] #{window_index}#(echo ':')#{window_name}#{window_flag} "
 set-option -g window-status-current-format " #[bold bg=#151515] > #{window_index}#(echo ':')#{window_name}#{window_flag} "
@@ -36,10 +36,11 @@ setw -g mode-keys vi
 setw -g mouse off
 
 # split panes
-bind s split-window -h
-bind t split-window -v
+bind h split-window -h
+bind v split-window -v
 unbind '"'
 unbind %
+bind s list-sessions
 
 bind-key N resize-pane -D 5
 bind-key E resize-pane -U 5
@@ -71,4 +72,10 @@ set -g base-index 1
 set -sg escape-time 0
 
 # Fire up a floating terminal
-bind -n M-g display-popup -E "tmux new-session -A -s scratch"
+bind-key -n -N 'Toggle popup window' M-g if-shell -F '#{==:#{session_name},popup}' {
+    detach-client
+} {
+    display-popup -d "#{pane_current_path}" \
+    -xC -yC -w 80% -h 75% \
+    -E 'tmux attach-session -t popup || tmux new-session -s popup'
+}
-- 
cgit v1.2.3-70-g09d2