perf: batch tmux show (#288)
* feat: batch tmux show options * dont check for duplicates * fix: status modules * batch and cache build_window_icon * perf: batch new options * chore: tmux_batch_setup_module -> tmux_batch_setup_status_module * fixup! perf: batch tmux show-options (#240) Changes the line separator used by tmux_batch from ':' to the ascii unit separator FIXES: #240 * fix: string escaping of `..._tmux_batch_...` `tmux show -v <option>` returns/prints the escaped value while the value string of `tmux show <option>` is not escaped. FIXES: #281
This commit is contained in:
parent
df238924bc
commit
99013fafe6
21 changed files with 371 additions and 136 deletions
|
@ -1,10 +1,13 @@
|
|||
show_application() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "application"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_option "@catppuccin_application_icon" "")
|
||||
color=$(get_tmux_option "@catppuccin_application_color" "$thm_pink")
|
||||
text=$(get_tmux_option "@catppuccin_application_text" "#{pane_current_command}")
|
||||
icon=$(get_tmux_batch_option "@catppuccin_application_icon" "")
|
||||
color=$(get_tmux_batch_option "@catppuccin_application_color" "$thm_pink")
|
||||
text=$(get_tmux_batch_option "@catppuccin_application_text" "#{pane_current_command}")
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -1,24 +1,28 @@
|
|||
show_battery() {
|
||||
local index icon color text module
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_option "@catppuccin_battery_icon" "#{battery_icon}")
|
||||
color=$(get_tmux_option "@catppuccin_battery_color" "$thm_yellow")
|
||||
text=$(get_tmux_option "@catppuccin_battery_text" "#{battery_percentage}")
|
||||
tmux_batch_setup_status_module "battery"
|
||||
|
||||
tmux set-option -g @batt_icon_charge_tier8 ''
|
||||
tmux set-option -g @batt_icon_charge_tier7 ''
|
||||
tmux set-option -g @batt_icon_charge_tier6 ''
|
||||
tmux set-option -g @batt_icon_charge_tier5 ''
|
||||
tmux set-option -g @batt_icon_charge_tier4 ''
|
||||
tmux set-option -g @batt_icon_charge_tier3 ''
|
||||
tmux set-option -g @batt_icon_charge_tier2 ''
|
||||
tmux set-option -g @batt_icon_charge_tier1 ''
|
||||
tmux set-option -g @batt_icon_status_charged ''
|
||||
tmux set-option -g @batt_icon_status_charging ''
|
||||
tmux set-option -g @batt_icon_status_discharging ''
|
||||
tmux set-option -g @batt_icon_status_unknown ''
|
||||
tmux set-option -g @batt_icon_status_attached ""
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier8 ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier7 ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier6 ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier5 ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier4 ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier3 ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier2 ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier1 ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_charged ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_charging ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_discharging ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_unknown ;")
|
||||
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_attached ;")
|
||||
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_batch_option "@catppuccin_battery_icon" "#{battery_icon}")
|
||||
color=$(get_tmux_batch_option "@catppuccin_battery_color" "$thm_yellow")
|
||||
text=$(get_tmux_batch_option "@catppuccin_battery_text" "#{battery_percentage}")
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -2,10 +2,13 @@
|
|||
show_clima() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "clima"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon="$(get_tmux_option "@catppuccin_clima_icon" "")"
|
||||
color="$(get_tmux_option "@catppuccin_clima_color" "$thm_yellow")"
|
||||
text="$(get_tmux_option "@catppuccin_clima_text" "#{clima}")"
|
||||
icon="$(get_tmux_batch_option "@catppuccin_clima_icon" "")"
|
||||
color="$(get_tmux_batch_option "@catppuccin_clima_color" "$thm_yellow")"
|
||||
text="$(get_tmux_batch_option "@catppuccin_clima_text" "#{clima}")"
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
show_cpu() {
|
||||
local index icon color text module
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_option "@catppuccin_cpu_icon" "")
|
||||
color="$(get_tmux_option "@catppuccin_cpu_color" "#{cpu_bg_color}")"
|
||||
text="$(get_tmux_option "@catppuccin_cpu_text" "#{cpu_percentage}")"
|
||||
tmux_batch_setup_status_module "cpu"
|
||||
|
||||
tmux set-option -g @cpu_low_bg_color "$thm_yellow" # background color when cpu is low
|
||||
tmux set-option -g @cpu_medium_bg_color "$thm_orange" # background color when cpu is medium
|
||||
tmux set-option -g @cpu_high_bg_color "$thm_red" # background color when cpu is high
|
||||
tmux_batch_options_commands+=("set-option -gq @cpu_low_bg_color $thm_yellow ;") # background color when cpu is low
|
||||
tmux_batch_options_commands+=("set-option -gq @cpu_medium_bg_color $thm_orange ;") # background color when cpu is medium
|
||||
tmux_batch_options_commands+=("set-option -gq @cpu_high_bg_color $thm_red ;") # background color when cpu is high
|
||||
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_batch_option "@catppuccin_cpu_icon" "")
|
||||
color="$(get_tmux_batch_option "@catppuccin_cpu_color" "#{cpu_bg_color}")"
|
||||
text="$(get_tmux_batch_option "@catppuccin_cpu_text" "#{cpu_percentage}")"
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
show_date_time() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "date_time"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon="$(get_tmux_option "@catppuccin_date_time_icon" "")"
|
||||
color="$(get_tmux_option "@catppuccin_date_time_color" "$thm_blue")"
|
||||
text="$(get_tmux_option "@catppuccin_date_time_text" "%Y-%m-%d %H:%M")"
|
||||
icon="$(get_tmux_batch_option "@catppuccin_date_time_icon" "")"
|
||||
color="$(get_tmux_batch_option "@catppuccin_date_time_color" "$thm_blue")"
|
||||
text="$(get_tmux_batch_option "@catppuccin_date_time_text" "%Y-%m-%d %H:%M")"
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
show_directory() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "directory"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_option "@catppuccin_directory_icon" "")
|
||||
color=$(get_tmux_option "@catppuccin_directory_color" "$thm_pink")
|
||||
text=$(get_tmux_option "@catppuccin_directory_text" "#{b:pane_current_path}")
|
||||
icon=$(get_tmux_batch_option "@catppuccin_directory_icon" "")
|
||||
color=$(get_tmux_batch_option "@catppuccin_directory_color" "$thm_pink")
|
||||
text=$(get_tmux_batch_option "@catppuccin_directory_text" "#{b:pane_current_path}")
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
show_gitmux() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "gitmux"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon="$(get_tmux_option "@catppuccin_gitmux_icon" "")"
|
||||
color="$(get_tmux_option "@catppuccin_gitmux_color" "$thm_green")"
|
||||
text="$(get_tmux_option "@catppuccin_gitmux_text" "#(gitmux \"#{pane_current_path}\")")"
|
||||
icon="$(get_tmux_batch_option "@catppuccin_gitmux_icon" "")"
|
||||
color="$(get_tmux_batch_option "@catppuccin_gitmux_color" "$thm_green")"
|
||||
text="$(get_tmux_batch_option "@catppuccin_gitmux_text" "#(gitmux \"#{pane_current_path}\")")"
|
||||
|
||||
module=$( build_status_module "$index" "$icon" "$color" "$text" )
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
show_host() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "host"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_option "@catppuccin_host_icon" "")
|
||||
color=$(get_tmux_option "@catppuccin_host_color" "$thm_magenta")
|
||||
text=$(get_tmux_option "@catppuccin_host_text" "#H")
|
||||
icon=$(get_tmux_batch_option "@catppuccin_host_icon" "")
|
||||
color=$(get_tmux_batch_option "@catppuccin_host_color" "$thm_magenta")
|
||||
text=$(get_tmux_batch_option "@catppuccin_host_text" "#H")
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -3,15 +3,22 @@
|
|||
show_kube() {
|
||||
local index icon color text context_color namespace_color symbol_enabled module
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_option "@catppuccin_kube_icon" "")
|
||||
color=$(get_tmux_option "@catppuccin_kube_color" "$thm_blue")
|
||||
context_color=$(get_tmux_option "@catppuccin_kube_context_color" "#{thm_red}")
|
||||
namespace_color=$(get_tmux_option "@catppuccin_kube_namespace_color" "#{thm_cyan}")
|
||||
symbol_enabled=${KUBE_TMUX_SYMBOL_ENABLE:-false}
|
||||
text=$(get_tmux_option "@catppuccin_kube_text" "#(KUBE_TMUX_SYMBOL_ENABLE=$symbol_enabled ${TMUX_PLUGIN_MANAGER_PATH}kube-tmux/kube.tmux 250 '$context_color' '$namespace_color')")
|
||||
tmux_batch_setup_status_module "kube"
|
||||
|
||||
module=$( build_status_module "$index" "$icon" "$color" "$text" )
|
||||
add_tmux_batch_option "@catppuccin_kube_context_color"
|
||||
add_tmux_batch_option "@catppuccin_kube_namespace_color"
|
||||
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_batch_option "@catppuccin_kube_icon" "")
|
||||
color=$(get_tmux_batch_option "@catppuccin_kube_color" "$thm_blue")
|
||||
context_color=$(get_tmux_batch_option "@catppuccin_kube_context_color" "#{thm_red}")
|
||||
namespace_color=$(get_tmux_batch_option "@catppuccin_kube_namespace_color" "#{thm_cyan}")
|
||||
symbol_enabled=${KUBE_TMUX_SYMBOL_ENABLE:-false}
|
||||
text=$(get_tmux_batch_option "@catppuccin_kube_text" "#(KUBE_TMUX_SYMBOL_ENABLE=$symbol_enabled ${TMUX_PLUGIN_MANAGER_PATH}kube-tmux/kube.tmux 250 '$context_color' '$namespace_color')")
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
echo "$module"
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
show_load() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "load"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon="$(get_tmux_option "@catppuccin_load_icon" "")"
|
||||
color="$(get_tmux_option "@catppuccin_load_color" "$thm_blue")"
|
||||
text="$(get_tmux_option "@catppuccin_load_text" "#{load_full}")"
|
||||
icon="$(get_tmux_batch_option "@catppuccin_load_icon" "")"
|
||||
color="$(get_tmux_batch_option "@catppuccin_load_color" "$thm_blue")"
|
||||
text="$(get_tmux_batch_option "@catppuccin_load_text" "#{load_full}")"
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
show_pomodoro_plus() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "pomodoro_plus"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon="$( get_tmux_option "@catppuccin_pomodoro_plus_icon" "" )"
|
||||
color="$( get_tmux_option "@catppuccin_pomodoro_plus_color" "$thm_orange" )"
|
||||
text="$( get_tmux_option "@catppuccin_pomodoro_plus_text" "#{pomodoro_status}" )"
|
||||
icon="$( get_tmux_batch_option "@catppuccin_pomodoro_plus_icon" "" )"
|
||||
color="$( get_tmux_batch_option "@catppuccin_pomodoro_plus_color" "$thm_orange" )"
|
||||
text="$( get_tmux_batch_option "@catppuccin_pomodoro_plus_text" "#{pomodoro_status}" )"
|
||||
|
||||
module=$( build_status_module "$index" "$icon" "$color" "$text" )
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
show_session() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "session"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_option "@catppuccin_session_icon" "")
|
||||
color=$(get_tmux_option "@catppuccin_session_color" "#{?client_prefix,$thm_red,$thm_green}")
|
||||
text=$(get_tmux_option "@catppuccin_session_text" "#S")
|
||||
icon=$(get_tmux_batch_option "@catppuccin_session_icon" "")
|
||||
color=$(get_tmux_batch_option "@catppuccin_session_color" "#{?client_prefix,$thm_red,$thm_green}")
|
||||
text=$(get_tmux_batch_option "@catppuccin_session_text" "#S")
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
show_uptime() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "uptime"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon="$(get_tmux_option "@catppuccin_uptime_icon" "")"
|
||||
color="$(get_tmux_option "@catppuccin_uptime_color" "$thm_green")"
|
||||
text="$(get_tmux_option "@catppuccin_uptime_text" "#(uptime | sed 's/^[^,]*up *//; s/, *[[:digit:]]* user.*//; s/ day.*, */d /; s/:/h /; s/ min//; s/$/m/')")"
|
||||
icon="$(get_tmux_batch_option "@catppuccin_uptime_icon" "")"
|
||||
color="$(get_tmux_batch_option "@catppuccin_uptime_color" "$thm_green")"
|
||||
text="$(get_tmux_batch_option "@catppuccin_uptime_text" "#(uptime | sed 's/^[^,]*up *//; s/, *[[:digit:]]* user.*//; s/ day.*, */d /; s/:/h /; s/ min//; s/$/m/')")"
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
show_user() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "user"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon=$(get_tmux_option "@catppuccin_user_icon" "")
|
||||
color=$(get_tmux_option "@catppuccin_user_color" "$thm_cyan")
|
||||
text=$(get_tmux_option "@catppuccin_user_text" "#(whoami)")
|
||||
icon=$(get_tmux_batch_option "@catppuccin_user_icon" "")
|
||||
color=$(get_tmux_batch_option "@catppuccin_user_color" "$thm_cyan")
|
||||
text=$(get_tmux_batch_option "@catppuccin_user_text" "#(whoami)")
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
show_weather() {
|
||||
local index icon color text module
|
||||
|
||||
tmux_batch_setup_status_module "weather"
|
||||
run_tmux_batch_commands
|
||||
|
||||
index=$1
|
||||
icon="$(get_tmux_option "@catppuccin_weather_icon" "")"
|
||||
color="$(get_tmux_option "@catppuccin_weather_color" "$thm_yellow")"
|
||||
text="$(get_tmux_option "@catppuccin_weather_text" "#{weather}")"
|
||||
icon="$(get_tmux_batch_option "@catppuccin_weather_icon" "")"
|
||||
color="$(get_tmux_batch_option "@catppuccin_weather_color" "$thm_yellow")"
|
||||
text="$(get_tmux_batch_option "@catppuccin_weather_text" "#{weather}")"
|
||||
|
||||
module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue