diff --git a/src/options.go b/src/options.go index 0b6250f35e7..4d8273b1e2c 100644 --- a/src/options.go +++ b/src/options.go @@ -78,6 +78,7 @@ Usage: fzf [options] --tmux[=OPTS] Start fzf in a tmux popup (requires tmux 3.3+) [center|top|bottom|left|right][,SIZE[%]][,SIZE[%]] (default: center,50%) + --tmux-title=STR Add given title to tmux popup (requires tmux 3.3+) --layout=LAYOUT Choose layout: [default|reverse|reverse-list] --border[=STYLE] Draw border around the finder [rounded|sharp|bold|block|thinblock|double|horizontal|vertical| @@ -457,6 +458,7 @@ type Options struct { Output chan string NoWinpty bool Tmux *tmuxOptions + TmuxTitle string ForceTtyIn bool ProxyScript string Bash bool @@ -2674,6 +2676,8 @@ func parseOptions(index *int, opts *Options, allArgs []string) error { if opts.Tmux, err = parseTmuxOptions(value, index); err != nil { return err } + } else if match, value := optString(arg, "--tmux-title="); match { + opts.TmuxTitle = value } else if match, value := optString(arg, "--scheme="); match { opts.Scheme = strings.ToLower(value) } else if match, value := optString(arg, "-q", "--query="); match { diff --git a/src/tmux.go b/src/tmux.go index b2315dcd2c3..e3b993d9681 100644 --- a/src/tmux.go +++ b/src/tmux.go @@ -33,7 +33,7 @@ func runTmux(args []string, opts *Options) (int, error) { // M Both The mouse position // W Both The window position on the status line // S -y The line above or below the status line - tmuxArgs := []string{"display-popup", "-E", "-B", "-d", dir} + tmuxArgs := []string{"display-popup", "-E", "-d", dir} switch opts.Tmux.position { case posUp: tmuxArgs = append(tmuxArgs, "-xC", "-y0") @@ -49,6 +49,12 @@ func runTmux(args []string, opts *Options) (int, error) { tmuxArgs = append(tmuxArgs, "-w"+opts.Tmux.width.String()) tmuxArgs = append(tmuxArgs, "-h"+opts.Tmux.height.String()) + if opts.TmuxTitle != "" { + tmuxArgs = append(tmuxArgs, "-T"+opts.TmuxTitle) + } else { + tmuxArgs = append(tmuxArgs, "-B") + } + return runProxy(argStr, func(temp string, needBash bool) (*exec.Cmd, error) { sh, err := sh(needBash) if err != nil {