Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add border-native option to --tmux flag #4157

Merged
merged 7 commits into from
Jan 4, 2025

Conversation

aead
Copy link
Contributor

@aead aead commented Jan 3, 2025

This commit adds the border-native resulting in
the following:

--tmux[=[center|top|bottom|left|right][,SIZE[%]][,SIZE[%]][,border-native]]

By default, when not specified, the -B flag is passed to the
tmux popup-window command such that no border is drawn around
the tmux popup window.

When the border-native option is present the -B flag is omitted
and the popup window is drawn using the border style configured in
the tmux config file.

Fixes #4156

@aead aead changed the title add native-border option to --tmux flag add border-native option to --tmux flag Jan 3, 2025
This commit adds the `border-native` resulting in
the following:
```
--tmux[=[center|top|bottom|left|right][,SIZE[%]][,SIZE[%]][,border-native]]
```

By default, when not specified, the `-B` flag is passed to the
`tmux popup-window` command such that no border is drawn around
the tmux popup window.

When the `border-native` option is present the `-B` flag is omitted
and the popup window is drawn using the border style configured in
the tmux config file.

Fixes #4156

Signed-off-by: Andreas Auernhammer <[email protected]>
@aead aead force-pushed the tmux-border-option branch from dc73b93 to fb16c09 Compare January 3, 2025 15:17
src/options.go Outdated Show resolved Hide resolved
src/options.go Outdated Show resolved Hide resolved
@aead aead requested a review from junegunn January 3, 2025 16:39
src/tmux.go Show resolved Hide resolved
src/options.go Outdated Show resolved Hide resolved
@aead aead requested a review from junegunn January 3, 2025 19:19
@junegunn
Copy link
Owner

junegunn commented Jan 4, 2025

I updated the branch to prepend --margin 0,1 so that it looks similar to when --border is used. What do you think? fzf-tmux used to do that before tmux 3.3 when there was no way to disable the native border.

fzf --tmux
fzf --tmux border-native
fzf --tmux --list-border
fzf --tmux border-native --list-border

One gotcha is that the extra margin is not colored when you use a non-default background color, but I don't think it's a critical problem.

fzf --tmux --color bg:#ff0000

fzf --tmux border-native --color bg:#ff0000

fzf --tmux border-native --color bg:#ff0000 --margin 0

@aead
Copy link
Contributor Author

aead commented Jan 4, 2025

The added margin does make it look nicer! For example,
Screenshot 2025-01-04 at 09 01 31
Screenshot 2025-01-04 at 09 00 01

And with set -g popup-border-lines rounded and coloring one can make both borders identical.

One gotcha is that the extra margin is not colored when you use a non-default background color, but I don't think it's a critical problem.

Yeah, and with --margin 0 you can turn it off if you really want to.

Since the native border is styled by tmux, FZF could forward its --border and --color styles to tmux to adjust things dynamically with tmux popup -S -b. However, even if, this may require a separate PR.

@junegunn junegunn merged commit 120cd7f into junegunn:master Jan 4, 2025
5 checks passed
@junegunn
Copy link
Owner

junegunn commented Jan 4, 2025

Merged, thanks!

@aead aead deleted the tmux-border-option branch January 4, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] add an option to enable tmux popup window borders
2 participants