From 99f717efcb75ae6eeb8a40252b406f01a14d4d58 Mon Sep 17 00:00:00 2001 From: aleidk Date: Wed, 28 Aug 2024 12:05:05 -0400 Subject: [PATCH] update tmux popup config --- chezmoi/dot_config/tmux/tmux.conf | 3 ++- scripts/fzf-tmux-sessions | 23 ++++++++++++----------- scripts/fzf-tmux-tools-popup | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 12 deletions(-) create mode 100755 scripts/fzf-tmux-tools-popup diff --git a/chezmoi/dot_config/tmux/tmux.conf b/chezmoi/dot_config/tmux/tmux.conf index 568f9f2..55e1ca6 100644 --- a/chezmoi/dot_config/tmux/tmux.conf +++ b/chezmoi/dot_config/tmux/tmux.conf @@ -159,7 +159,8 @@ set -g @plugin "loichyan/tmux-toggle-popup" set -g @popup-id-format '#{b:socket_path}/#{session_name}/#{b:pane_current_path}/#{@popup_name}' # Use this to open specific programs in floating panes -bind C-o run "#{@popup-toggle} -Ed'#{pane_current_path}' -w90% -h90% --name=lazygit lazygit" +bind C-p run "#{@popup-toggle}" +bind C-o run "#{@popup-toggle} -Ed'#{pane_current_path}' -w90% -h90% --name=tool fzf-tmux-tools-popup" # ╭──────────────────────────────────────────────────────────╮ # │ FZF │ diff --git a/scripts/fzf-tmux-sessions b/scripts/fzf-tmux-sessions index e52eaa6..ebd8231 100755 --- a/scripts/fzf-tmux-sessions +++ b/scripts/fzf-tmux-sessions @@ -1,16 +1,17 @@ #!/usr/bin/env bash +exclude="(scratch)" # exclude this entries, use regex: /(name1|name2)/ + sesh connect "$( sesh list --hide-attached --icons | - rg --invert-match '(scratch)' | # exclude this entries, use regex: /(name1|name2)/ - fzf-tmux -p 55%,60% \ - --no-sort --border-label ' sesh ' --prompt '⚡ ' \ - --header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \ - --bind 'tab:down,btab:up' \ - --bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list --hide-attached --icons)' \ - --bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t --hide-attached --icons)' \ - --bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c --hide-attached --icons)' \ - --bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z --hide-attached --icons)' \ - --bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \ - --bind 'ctrl-d:execute(tmux kill-session -t {})+change-prompt(⚡ )+reload(sesh list --hide-attached --icons)' + rg --invert-match "$exclude" | fzf-tmux -p 55%,60% \ + --no-sort --border-label ' sesh ' --prompt '⚡ ' \ + --header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \ + --bind "tab:down,btab:up" \ + --bind "ctrl-a:change-prompt(⚡ )+reload(sesh list --hide-attached --icons | rg --invert-match '$exclude')" \ + --bind "ctrl-t:change-prompt(🪟 )+reload(sesh list -t --hide-attached --icons | rg --invert-match '$exclude')" \ + --bind "ctrl-g:change-prompt(⚙️ )+reload(sesh list -c --hide-attached --icons | rg --invert-match '$exclude')" \ + --bind "ctrl-x:change-prompt(📁 )+reload(sesh list -z --hide-attached --icons | rg --invert-match '$exclude')" \ + --bind "ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)" \ + --bind "ctrl-d:execute(tmux kill-session -t {2})+change-prompt(⚡ )+reload(sesh list --hide-attached --icons | rg --invert-match '$exclude')" )" diff --git a/scripts/fzf-tmux-tools-popup b/scripts/fzf-tmux-tools-popup new file mode 100755 index 0000000..3d2d7d1 --- /dev/null +++ b/scripts/fzf-tmux-tools-popup @@ -0,0 +1,17 @@ +#! /usr/bin/env bash + +set -e + +declare -A tools + +tools[Lazygit]="lazygit" +tools[Databases]="cd ~/.local/share/db_ui; nvim -c 'DBUI'" + +cli="$(printf "%s\n" "${!tools[@]}" | fzf)" +cli="${tools[$cli]}" + +if [[ -z "$cli" ]]; then + exit +fi + +eval "$cli"