Skip to content

Commit a8a639b

Browse files
committed
Add support for --tmux-title option
1 parent c2e1861 commit a8a639b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/options.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Usage: fzf [options]
7878
--tmux[=OPTS] Start fzf in a tmux popup (requires tmux 3.3+)
7979
[center|top|bottom|left|right][,SIZE[%]][,SIZE[%]]
8080
(default: center,50%)
81+
--tmux-title=STR Add given title to tmux popup (requires tmux 3.3+)
8182
--layout=LAYOUT Choose layout: [default|reverse|reverse-list]
8283
--border[=STYLE] Draw border around the finder
8384
[rounded|sharp|bold|block|thinblock|double|horizontal|vertical|
@@ -457,6 +458,7 @@ type Options struct {
457458
Output chan string
458459
NoWinpty bool
459460
Tmux *tmuxOptions
461+
TmuxTitle string
460462
ForceTtyIn bool
461463
ProxyScript string
462464
Bash bool
@@ -2674,6 +2676,8 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
26742676
if opts.Tmux, err = parseTmuxOptions(value, index); err != nil {
26752677
return err
26762678
}
2679+
} else if match, value := optString(arg, "--tmux-title="); match {
2680+
opts.TmuxTitle = value
26772681
} else if match, value := optString(arg, "--scheme="); match {
26782682
opts.Scheme = strings.ToLower(value)
26792683
} else if match, value := optString(arg, "-q", "--query="); match {

src/tmux.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func runTmux(args []string, opts *Options) (int, error) {
3333
// M Both The mouse position
3434
// W Both The window position on the status line
3535
// S -y The line above or below the status line
36-
tmuxArgs := []string{"display-popup", "-E", "-B", "-d", dir}
36+
tmuxArgs := []string{"display-popup", "-E", "-d", dir}
3737
switch opts.Tmux.position {
3838
case posUp:
3939
tmuxArgs = append(tmuxArgs, "-xC", "-y0")
@@ -49,6 +49,12 @@ func runTmux(args []string, opts *Options) (int, error) {
4949
tmuxArgs = append(tmuxArgs, "-w"+opts.Tmux.width.String())
5050
tmuxArgs = append(tmuxArgs, "-h"+opts.Tmux.height.String())
5151

52+
if opts.TmuxTitle != "" {
53+
tmuxArgs = append(tmuxArgs, "-T"+opts.TmuxTitle)
54+
} else {
55+
tmuxArgs = append(tmuxArgs, "-B")
56+
}
57+
5258
return runProxy(argStr, func(temp string, needBash bool) (*exec.Cmd, error) {
5359
sh, err := sh(needBash)
5460
if err != nil {

0 commit comments

Comments
 (0)