#!/bin/sh # @(#)$KimmoSuominen: .cfg/home/misc/tmux-session-switcher,v 1.6 2026/04/25 03:39:32 kim Exp $ # ~/misc/tmux-session-switcher if command -v sesh > /dev/null 2>&1 then sel=$(sesh list --icons | fzf-tmux -p 90%,70% \ --exact --no-sort --ansi --border-label ' sesh ' --prompt '  ' \ --header '^a all ^t tmux ^g cfg ^x zoxide ^d kill ^f find' \ --bind 'tab:down,btab:up' \ --bind 'ctrl-a:change-prompt(  )+reload(sesh list --icons)' \ --bind 'ctrl-t:change-prompt(  )+reload(sesh list -t --icons)' \ --bind 'ctrl-g:change-prompt( 󰒓 )+reload(sesh list -c --icons)' \ --bind 'ctrl-x:change-prompt(  )+reload(sesh list -z --icons)' \ --bind 'ctrl-f:change-prompt(  )+reload(fd -t d -d 2 . ~)' \ --bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(  )+reload(sesh list --icons)' \ --preview-window 'right:55%' \ --preview 'sesh preview {}') [ -n "$sel" ] && sesh connect "${sel}" || exit 0 else fmt='#{session_name}' sel=$(tmux list-sessions -F "$fmt" | fzf-tmux -p \ --exact --no-sort --ansi --border-label ' sessions ' \ --header '^d kill session' \ --bind 'tab:down,btab:up' \ --bind "ctrl-d:execute-silent(tmux kill-session -t {1})+reload(tmux list-sessions -F '$fmt')" \ ) [ -n "$sel" ] && tmux switch-client -t "$sel" || exit 0 fi