From c19fa68472bec357914ff264e52b45945221d530 Mon Sep 17 00:00:00 2001 From: Pascal Dulieu Date: Wed, 30 Jul 2025 11:45:00 +0100 Subject: init --- .config/tmux-powerline/themes/main.sh | 230 ++++++++++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 .config/tmux-powerline/themes/main.sh (limited to '.config/tmux-powerline/themes') diff --git a/.config/tmux-powerline/themes/main.sh b/.config/tmux-powerline/themes/main.sh new file mode 100644 index 0000000..c558c2b --- /dev/null +++ b/.config/tmux-powerline/themes/main.sh @@ -0,0 +1,230 @@ +# shellcheck shell=bash +# Pywal Theme - Integrated with pywal colors +# If changes made here does not take effect, then try to re-create the tmux session to force reload. + +# Source pywal colors if available +if [ -f "${HOME}/.cache/wal/colors.sh" ]; then + # shellcheck source=/dev/null + source "${HOME}/.cache/wal/colors.sh" +fi + +if tp_patched_font_in_use; then + TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="" + TMUX_POWERLINE_SEPARATOR_LEFT_THIN="" + TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="" + TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="" +else + TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="◀" + TMUX_POWERLINE_SEPARATOR_LEFT_THIN="❮" + TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="▶" + TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="❯" +fi + +# See Color formatting section below for details on what colors can be used here. +# Use pywal colors if available, otherwise fallback to defaults +if [ -n "$background" ] && [ -n "$foreground" ]; then + TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR=${TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR:-"$background"} + TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR=${TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR:-"$foreground"} +else + TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR=${TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR:-'235'} + TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR=${TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR:-'255'} +fi +# shellcheck disable=SC2034 +TMUX_POWERLINE_SEG_AIR_COLOR=$(tp_air_color) + +TMUX_POWERLINE_DEFAULT_LEFTSIDE_SEPARATOR=${TMUX_POWERLINE_DEFAULT_LEFTSIDE_SEPARATOR:-$TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD} +TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SEPARATOR=${TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SEPARATOR:-$TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} + +# See `man tmux` for additional formatting options for the status line. +# The `format regular` and `format inverse` functions are provided as conveniences + +# shellcheck disable=SC2128 +if [ -z "$TMUX_POWERLINE_WINDOW_STATUS_CURRENT" ]; then + TMUX_POWERLINE_WINDOW_STATUS_CURRENT=( + "#[$(tp_format inverse)]" + "$TMUX_POWERLINE_DEFAULT_LEFTSIDE_SEPARATOR" + " #I#F " + "$TMUX_POWERLINE_SEPARATOR_RIGHT_THIN" + " #W " + "#[$(tp_format regular)]" + "$TMUX_POWERLINE_DEFAULT_LEFTSIDE_SEPARATOR" + ) +fi + +# shellcheck disable=SC2128 +if [ -z "$TMUX_POWERLINE_WINDOW_STATUS_STYLE" ]; then + TMUX_POWERLINE_WINDOW_STATUS_STYLE=( + "$(tp_format regular)" + ) +fi + +# shellcheck disable=SC2128 +if [ -z "$TMUX_POWERLINE_WINDOW_STATUS_FORMAT" ]; then + TMUX_POWERLINE_WINDOW_STATUS_FORMAT=( + "#[$(tp_format regular)]" + " #I#{?window_flags,#F, } " + "$TMUX_POWERLINE_SEPARATOR_RIGHT_THIN" + " #W " + ) +fi + +# Format: segment_name [background_color|default_bg_color] [foreground_color|default_fg_color] [non_default_separator|default_separator] [separator_background_color|no_sep_bg_color] +# [separator_foreground_color|no_sep_fg_color] [spacing_disable|no_spacing_disable] [separator_disable|no_separator_disable] +# +# * background_color and foreground_color. Color formatting (see `man tmux` for complete list) or run the color_palette.sh in the tmux-powerline root directory: +# * Named colors, e.g. black, red, green, yellow, blue, magenta, cyan, white +# * Hexadecimal RGB string e.g. #ffffff +# * 'default_fg_color|default_bg_color' for the default theme bg and fg color +# * 'default' for the default tmux color. +# * 'terminal' for the terminal's default background/foreground color +# * The numbers 0-255 for the 256-color palette. Run `tmux-powerline/color-palette.sh` to see the colors. +# * non_default_separator - specify an alternative character for this segment's separator +# * 'default_separator' for the theme default separator +# * separator_background_color - specify a unique background color for the separator +# * 'no_sep_bg_color' for using the default coloring for the separator +# * separator_foreground_color - specify a unique foreground color for the separator +# * 'no_sep_fg_color' for using the default coloring for the separator +# * spacing_disable - remove space on left, right or both sides of the segment: +# * "no_spacing_disable" - don't disable spacing (default) +# * "left_disable" - disable space on the left +# * "right_disable" - disable space on the right +# * "both_disable" - disable spaces on both sides +# * - any other character/string produces no change to default behavior (eg "none", "X", etc.) +# +# * separator_disable - disables drawing a separator on this segment, very useful for segments +# with dynamic background colours (eg tmux_mem_cpu_load): +# * "no_separator_disable" - don't disable the separator (default) +# * "separator_disable" - disables the separator +# * - any other character/string produces no change to default behavior +# +# Example segment with separator disabled and right space character disabled: +# "hostname 33 0 {TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD} 0 0 right_disable separator_disable" +# +# Example segment with spacing characters disabled on both sides but not touching the default coloring: +# "hostname 33 0 {TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD} no_sep_bg_color no_sep_fg_color both_disable" +# +# Example segment with changing the foreground color of the default separator: +# "hostname 33 0 default_separator no_sep_bg_color 120" +# +## Note that although redundant the non_default_separator, separator_background_color and +# separator_foreground_color options must still be specified so that appropriate index +# of options to support the spacing_disable and separator_disable features can be used +# The default_* and no_* can be used to keep the default behaviour. + +# shellcheck disable=SC1143,SC2128 +if [ -z "$TMUX_POWERLINE_LEFT_STATUS_SEGMENTS" ]; then + # Use pywal colors if available, otherwise use defaults + # shellcheck disable=SC2154 + if [ -n "$color5" ] && [ -n "$background" ]; then + # shellcheck disable=SC2154 + TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=( + # shellcheck disable=SC2154 + "tmux_session_info ${color5} ${background}" + # shellcheck disable=SC2154 + "hostname ${color3} ${background}" + #"mode_indicator 165 0" + #"ifstat 30 255" + #"ifstat_sys 30 255" + # shellcheck disable=SC2154 + # "lan_ip ${color6} ${background} ${TMUX_POWERLINE_SEPARATOR_RIGHT_THIN}" + #"vpn 24 255 ${TMUX_POWERLINE_SEPARATOR_RIGHT_THIN}" + # shellcheck disable=SC2154 + # "wan_ip ${color6} ${background} ${TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD} ${color2} ${background}" + # shellcheck disable=SC2154 + "vcs_branch ${color2} ${background}" + #"vcs_compare 60 255" + #"vcs_staged 64 255" + #"vcs_modified 9 255" + #"vcs_others 245 0" + ) + else + TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=( + "tmux_session_info 148 234" + "hostname 33 0" + #"mode_indicator 165 0" + #"ifstat 30 255" + #"ifstat_sys 30 255" + # "lan_ip 24 255 ${TMUX_POWERLINE_SEPARATOR_RIGHT_THIN}" + #"vpn 24 255 ${TMUX_POWERLINE_SEPARATOR_RIGHT_THIN}" + # "wan_ip 24 255 ${TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD} 29 255" + "vcs_branch 29 88" + #"vcs_compare 60 255" + #"vcs_staged 64 255" + #"vcs_modified 9 255" + #"vcs_others 245 0" + ) + fi +fi + +# shellcheck disable=SC1143,SC2128 +if [ -z "$TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS" ]; then + # Use pywal colors if available, otherwise use defaults + # shellcheck disable=SC2154 + if [ -n "$color1" ] && [ -n "$background" ] && [ -n "$foreground" ]; then + # shellcheck disable=SC2154 + TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS=( + #"earthquake 3 0" + # shellcheck disable=SC2154 + "pwd ${color4} ${background}" + #"macos_notification_count 29 255" + #"mailcount 9 255" + "now_playing 234 37" + #"cpu 240 136" + # shellcheck disable=SC2154 + # "load ${color8} ${background}" + #"tmux_mem_cpu_load 234 136" + # shellcheck disable=SC2154 + "battery ${color5} ${background}" + #"air ${TMUX_POWERLINE_SEG_AIR_COLOR} 255" + # shellcheck disable=SC2154 + "weather ${color14} ${background}" + #"rainbarf 0 ${TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR}" + # "$( + # if (($(tp_cpu_temp_at_least 60))); then + # echo "cpu_temp #ff2020 235" + # else + # echo "cpu_temp #303080 136" + # fi + # )" \ + #"xkb_layout 125 117" + #"tmux_continuum_save" + #"tmux_continuum_status 14 7" + # shellcheck disable=SC2154 + "date_day ${color1} ${background}" + # shellcheck disable=SC2154 + "date ${color1} ${background} ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" + # shellcheck disable=SC2154 + "time ${color1} ${background} ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" + #"utc_time 235 136 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" + ) + else + TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS=( + #"earthquake 3 0" + "pwd 89 211" + #"macos_notification_count 29 255" + #"mailcount 9 255" + "now_playing 234 37" + #"cpu 240 136" + # "load 237 167" + #"tmux_mem_cpu_load 234 136" + "battery 137 127" + #"air ${TMUX_POWERLINE_SEG_AIR_COLOR} 255" + "weather 37 255" + #"rainbarf 0 ${TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR}" + # "$( + # if (($(tp_cpu_temp_at_least 60))); then + # echo "cpu_temp #ff2020 235" + # else + # echo "cpu_temp #303080 136" + # fi + # )" \ + #"xkb_layout 125 117" + #"tmux_continuum_save" + #"tmux_continuum_status 14 7" + "date_day 235 136" + "date 235 136 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" + "time 235 136 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" + #"utc_time 235 136 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" + ) + fi +fi -- cgit v1.2.3