feat: add icons only option

This commit is contained in:
Abhishek Keshri 2024-03-27 10:26:05 +05:30 committed by Abhishek Keshri
parent 6a56a82120
commit c5f9c6ec28

View file

@ -15,6 +15,8 @@ wr_sep=$(get_tmux_option "@tmux2k-window-right-sep" )
show_flags=$(get_tmux_option "@tmux2k-show-flags" true) show_flags=$(get_tmux_option "@tmux2k-show-flags" true)
IFS=' ' read -r -a lplugins <<<"$(get_tmux_option '@tmux2k-left-plugins' 'git cpu ram')" IFS=' ' read -r -a lplugins <<<"$(get_tmux_option '@tmux2k-left-plugins' 'git cpu ram')"
IFS=' ' read -r -a rplugins <<<"$(get_tmux_option '@tmux2k-right-plugins' 'battery network time')" IFS=' ' read -r -a rplugins <<<"$(get_tmux_option '@tmux2k-right-plugins' 'battery network time')"
theme=$(get_tmux_option "@tmux2k-theme" 'default')
icons_only=$(get_tmux_option "@tmux2k-icons-only" false)
text=$(get_tmux_option "@tmux2k-text" '#282a36') text=$(get_tmux_option "@tmux2k-text" '#282a36')
bg_main=$(get_tmux_option "@tmux2k-bg-main" '#15152a') bg_main=$(get_tmux_option "@tmux2k-bg-main" '#15152a')
@ -45,9 +47,20 @@ declare -A plugin_colors=(
["time"]="light_blue text" ["time"]="light_blue text"
) )
theme=$(get_tmux_option "@tmux2k-theme" 'default') get_plugin_colors() {
local plugin_name="$1"
local default_colors="${plugin_colors[$plugin_name]}"
get_tmux_option "@tmux2k-${plugin_name}-colors" "$default_colors"
}
if [ "$theme" == "catpuccin" ]; then get_plugin_bg() {
IFS=' ' read -r -a colors <<<"$(get_plugin_colors "$1")"
return "${colors[0]}"
}
set_theme() {
case $theme in
"catppuccin")
bg_main=$(get_tmux_option "@tmux2k-bg-main" '#24273a') bg_main=$(get_tmux_option "@tmux2k-bg-main" '#24273a')
bg_alt=$(get_tmux_option "@tmux2k-bg-alt" '#363a4f') bg_alt=$(get_tmux_option "@tmux2k-bg-alt" '#363a4f')
black=$(get_tmux_option "@tmux2k-black" '#1e2030') black=$(get_tmux_option "@tmux2k-black" '#1e2030')
@ -62,11 +75,12 @@ if [ "$theme" == "catpuccin" ]; then
light_yellow=$(get_tmux_option "@tmux2k-light-yellow" '#eed49f') light_yellow=$(get_tmux_option "@tmux2k-light-yellow" '#eed49f')
purple=$(get_tmux_option "@tmux2k-purple" '#c6a0f6') purple=$(get_tmux_option "@tmux2k-purple" '#c6a0f6')
light_purple=$(get_tmux_option "@tmux2k-light-purple" '#f5bde6') light_purple=$(get_tmux_option "@tmux2k-light-purple" '#f5bde6')
fi ;;
esac
if [ "$theme" == "icons" ]; then if $icons_only; then
text=$bg_main text=$bg_main
declare -A plugin_colors=( plugin_colors=(
["git"]="text green" ["git"]="text green"
["cpu"]="text blue" ["cpu"]="text blue"
["ram"]="text light_yellow" ["ram"]="text light_yellow"
@ -78,17 +92,7 @@ if [ "$theme" == "icons" ]; then
["weather"]="text yellow" ["weather"]="text yellow"
["time"]="text light_blue" ["time"]="text light_blue"
) )
fi fi
get_plugin_colors() {
local plugin_name="$1"
local default_colors="${plugin_colors[$plugin_name]}"
get_tmux_option "@tmux2k-${plugin_name}-colors" "$default_colors"
}
get_plugin_bg() {
IFS=' ' read -r -a colors <<<"$(get_plugin_colors "$1")"
return "${colors[0]}"
} }
set_options() { set_options() {
@ -179,6 +183,7 @@ window_list() {
} }
main() { main() {
set_theme
set_options set_options
start_icon start_icon
status_bar "left" status_bar "left"