Tom Hale
Tom Hale

Reputation: 46715

tmux zoom in or out without toggle

tmux's zoom (< prefix> + z or resize-pane -Z) is a toggle.

How do I zoom out (restore) only if the current pane is already zoomed in?

How do I zoom in (maximize) only if the current pane is un-zoomed?

Upvotes: 2

Views: 3763

Answers (1)

Tom Hale
Tom Hale

Reputation: 46715

tmux-zoom-in.sh

#!/bin/bash

# Zoom in the current pane ONLY if it is not currently zoomed.
# Requires tmux version >= 1.8

tmux list-panes -F '#F' | grep -q Z || tmux resize-pane -Z
exit 0

tmux-zoom-out.sh

#!/bin/bash

# Zoom out the current pane ONLY if it is not currently zoomed.
# Requires tmux version >= 1.8

tmux list-panes -F '#F' | grep -q Z && tmux resize-pane -Z
exit 0

Upvotes: 4

Related Questions