mirror of
https://github.com/theniceboy/.config.git
synced 2026-02-22 21:05:57 +08:00
hide items in tmux statusline width for thinner viewport
This commit is contained in:
parent
61ace2ef02
commit
9b9ed00ee2
2 changed files with 57 additions and 1 deletions
|
|
@ -1,6 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# hide entire right status if terminal width is below threshold
|
||||
min_width=${TMUX_RIGHT_MIN_WIDTH:-90}
|
||||
width=$(tmux display-message -p '#{client_width}' 2>/dev/null || true)
|
||||
if [[ -z "${width:-}" || "$width" == "0" ]]; then
|
||||
width=$(tmux display-message -p '#{window_width}' 2>/dev/null || true)
|
||||
fi
|
||||
if [[ -z "${width:-}" || "$width" == "0" ]]; then
|
||||
width=${COLUMNS:-}
|
||||
fi
|
||||
if [[ -n "${width:-}" && "$width" =~ ^[0-9]+$ ]]; then
|
||||
if (( width < min_width )); then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
status_bg=$(tmux show -gqv status-bg)
|
||||
if [[ -z "$status_bg" || "$status_bg" == "default" ]]; then
|
||||
status_bg=black
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue