Simplify TMUX config and add RAM monitor.
This commit is contained in:
@@ -85,109 +85,4 @@ require('lazy').setup({{ -- Syntax Highlighting / Simple Code Completion
|
|||||||
vim.g.adwaita_transparent = true
|
vim.g.adwaita_transparent = true
|
||||||
vim.cmd.colorscheme "adwaita"
|
vim.cmd.colorscheme "adwaita"
|
||||||
end
|
end
|
||||||
}, {
|
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
dependencies = {'nvim-tree/nvim-web-devicons'},
|
|
||||||
config = function()
|
|
||||||
local colors = {
|
|
||||||
cyan = '#2aa1b3',
|
|
||||||
black = '#1f1f1f',
|
|
||||||
white = '#ffffff',
|
|
||||||
red = '#c01c28',
|
|
||||||
grey = '#303030',
|
|
||||||
yellow = '#a2734c',
|
|
||||||
green = '#26a269'
|
|
||||||
}
|
|
||||||
|
|
||||||
local bubbles_theme = {
|
|
||||||
normal = {
|
|
||||||
a = {
|
|
||||||
fg = colors.black,
|
|
||||||
bg = colors.green
|
|
||||||
},
|
|
||||||
b = {
|
|
||||||
fg = colors.white,
|
|
||||||
bg = colors.grey
|
|
||||||
},
|
|
||||||
c = {
|
|
||||||
fg = colors.white
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
insert = {
|
|
||||||
a = {
|
|
||||||
fg = colors.black,
|
|
||||||
bg = colors.yellow
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visual = {
|
|
||||||
a = {
|
|
||||||
fg = colors.black,
|
|
||||||
bg = colors.cyan
|
|
||||||
}
|
|
||||||
},
|
|
||||||
replace = {
|
|
||||||
a = {
|
|
||||||
fg = colors.black,
|
|
||||||
bg = colors.red
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
inactive = {
|
|
||||||
a = {
|
|
||||||
fg = colors.white,
|
|
||||||
bg = colors.black
|
|
||||||
},
|
|
||||||
b = {
|
|
||||||
fg = colors.white,
|
|
||||||
bg = colors.black
|
|
||||||
},
|
|
||||||
c = {
|
|
||||||
fg = colors.white
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
require('lualine').setup {
|
|
||||||
options = {
|
|
||||||
icons_enabled = true,
|
|
||||||
theme = bubbles_theme,
|
|
||||||
component_separators = '',
|
|
||||||
section_separators = {
|
|
||||||
left = '',
|
|
||||||
right = ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sections = {
|
|
||||||
lualine_a = {{
|
|
||||||
'mode',
|
|
||||||
separator = {
|
|
||||||
left = ''
|
|
||||||
},
|
|
||||||
right_padding = 2
|
|
||||||
}},
|
|
||||||
lualine_b = {'filename', 'branch'},
|
|
||||||
lualine_c = {'%=' --[[ add your center compoentnts here in place of this comment ]] },
|
|
||||||
lualine_x = {},
|
|
||||||
lualine_y = {'filetype', 'progress'},
|
|
||||||
lualine_z = {{
|
|
||||||
'location',
|
|
||||||
separator = {
|
|
||||||
right = ''
|
|
||||||
},
|
|
||||||
left_padding = 2
|
|
||||||
}}
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_a = {'filename'},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = {},
|
|
||||||
lualine_x = {},
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {'location'}
|
|
||||||
},
|
|
||||||
tabline = {},
|
|
||||||
extensions = {}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}})
|
}})
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
shell=bash
|
|
||||||
|
|
||||||
# TODO: Find a way to declare color variables
|
|
||||||
disable=SC2154
|
|
||||||
|
|
||||||
external-sources=true
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# Theme plugin
|
|
||||||
Forked from the TMUX Catppuccin theme and adapted for Adwaita.
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
build_status_module() {
|
|
||||||
local index="$1"
|
|
||||||
local icon="$2"
|
|
||||||
local color="$3"
|
|
||||||
local text="$4"
|
|
||||||
|
|
||||||
if [ "$status_fill" = "icon" ]; then
|
|
||||||
local bg
|
|
||||||
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
|
|
||||||
local show_text="#[fg=$thm_fg,bg=$thm_gray] $text"
|
|
||||||
|
|
||||||
if [ "$status_connect_separator" = "yes" ]; then
|
|
||||||
bg="$thm_gray"
|
|
||||||
else
|
|
||||||
bg="default"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local show_left_separator="#[fg=$color,bg=$bg,nobold,nounderscore,noitalics]$status_left_separator"
|
|
||||||
local show_middle_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_middle_separator"
|
|
||||||
local show_right_separator="#[fg=$thm_gray,bg=$bg,nobold,nounderscore,noitalics]$status_right_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$status_fill" = "all" ]; then
|
|
||||||
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
|
|
||||||
local show_text="#[fg=$thm_bg,bg=$color]$text"
|
|
||||||
|
|
||||||
if [ "$status_connect_separator" = "yes" ]; then
|
|
||||||
local show_left_separator="#[fg=$color,nobold,nounderscore,noitalics]$status_left_separator"
|
|
||||||
local show_right_separator="#[fg=$color,bg=$color,nobold,nounderscore,noitalics]$status_right_separator"
|
|
||||||
|
|
||||||
else
|
|
||||||
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
|
|
||||||
local show_right_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_right_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $((index)) -eq 0 ]; then
|
|
||||||
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$icon" ] ; then
|
|
||||||
show_icon=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
build_pane_format() {
|
|
||||||
local number=$1
|
|
||||||
local color=$2
|
|
||||||
local background=$3
|
|
||||||
local text=$4
|
|
||||||
local fill=$5
|
|
||||||
|
|
||||||
if [ "$pane_status_enable" = "yes" ]
|
|
||||||
then
|
|
||||||
if [ "$fill" = "none" ]
|
|
||||||
then
|
|
||||||
local show_left_separator="#[fg=$thm_gray,bg=default,nobold,nounderscore,noitalics]$pane_left_separator"
|
|
||||||
local show_number="#[fg=$thm_fg,bg=$thm_gray]$number"
|
|
||||||
local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$pane_middle_separator"
|
|
||||||
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
|
|
||||||
local show_right_separator="#[fg=$thm_gray,bg=default]$pane_right_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$fill" = "all" ]
|
|
||||||
then
|
|
||||||
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$pane_left_separator"
|
|
||||||
local show_number="#[fg=$background,bg=$color]$number"
|
|
||||||
local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$pane_middle_separator"
|
|
||||||
local show_text="#[fg=$background,bg=$color]$text"
|
|
||||||
local show_right_separator="#[fg=$color,bg=default]$pane_right_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$fill" = "number" ]
|
|
||||||
then
|
|
||||||
local show_number="#[fg=$background,bg=$color]$number"
|
|
||||||
local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$pane_middle_separator"
|
|
||||||
local show_text="#[fg=$thm_fg,bg=$background]$text"
|
|
||||||
|
|
||||||
if [ "$pane_number_position" = "right" ]
|
|
||||||
then
|
|
||||||
local show_left_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$pane_left_separator"
|
|
||||||
local show_right_separator="#[fg=$color,bg=default]$pane_right_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$pane_number_position" = "left" ]
|
|
||||||
then
|
|
||||||
local show_right_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$pane_right_separator"
|
|
||||||
local show_left_separator="#[fg=$color,bg=default]$pane_left_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
local final_pane_format
|
|
||||||
|
|
||||||
if [ "$pane_number_position" = "right" ]
|
|
||||||
then
|
|
||||||
final_pane_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$pane_number_position" = "left" ]
|
|
||||||
then
|
|
||||||
final_pane_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$final_pane_format"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
|
|
||||||
show_window_status=
|
|
||||||
|
|
||||||
build_window_format() {
|
|
||||||
local number="$1"
|
|
||||||
local color="$2"
|
|
||||||
local background="$3"
|
|
||||||
local text="$4"
|
|
||||||
local fill="$5"
|
|
||||||
local window_type="$6"
|
|
||||||
|
|
||||||
# NOTE: For backwards compatibility remove before 1.0.0 and update default for
|
|
||||||
# `@catppuccin_window_status`
|
|
||||||
if [ "$window_status" = "no" ]; then
|
|
||||||
window_status_enable="$(get_tmux_option "@catppuccin_window_status_enable" "")"
|
|
||||||
|
|
||||||
if [ -n "$window_status_enable" ]; then
|
|
||||||
tmux_echo "catppuccin warning: \\\"@catppuccin_window_status_enable\\\" and \\\"@catppuccin_window_status_icon_enable\\\" has been replaced by\n\t \
|
|
||||||
\\\"@catppuccin_window_status\\\" with the options \\\"no\\\", \\\"icon\\\" and \\\"text\\\"" 104
|
|
||||||
|
|
||||||
if [ "$window_status_enable" = "yes" ]; then
|
|
||||||
window_status_icon_enable="$(get_tmux_option "@catppuccin_window_status_icon_enable" "yes")"
|
|
||||||
if [ "$window_status_icon_enable" = "yes" ]; then
|
|
||||||
window_status="icon"
|
|
||||||
else
|
|
||||||
window_status="text"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
window_status="no"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! "$window_status" = "no" ]; then
|
|
||||||
local icon
|
|
||||||
icon="$(build_window_icon)"
|
|
||||||
text="$text$icon"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$window_type" = "current" ]; then
|
|
||||||
add_tmux_batch_option "@catppuccin_window_current_left_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_current_middle_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_current_right_separator"
|
|
||||||
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
window_left_separator=$(get_tmux_batch_option "@catppuccin_window_current_left_separator" "$window_left_separator")
|
|
||||||
window_middle_separator=$(get_tmux_batch_option "@catppuccin_window_current_middle_separator" "$window_middle_separator")
|
|
||||||
window_right_separator=$(get_tmux_batch_option "@catppuccin_window_current_right_separator" "$window_right_separator")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$fill" = "none" ]; then
|
|
||||||
local show_number="#[fg=$thm_fg,bg=$thm_gray]$number"
|
|
||||||
local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$window_middle_separator"
|
|
||||||
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
|
|
||||||
|
|
||||||
if [ "$status_connect_separator" = "yes" ]; then
|
|
||||||
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
|
|
||||||
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$window_right_separator"
|
|
||||||
|
|
||||||
else
|
|
||||||
local show_left_separator="#[fg=$thm_gray,bg=default,nobold,nounderscore,noitalics]$window_left_separator"
|
|
||||||
local show_right_separator="#[fg=$thm_gray,bg=default]$window_right_separator"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$fill" = "all" ]; then
|
|
||||||
local show_number="#[fg=$background,bg=$color]$number"
|
|
||||||
local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$window_middle_separator"
|
|
||||||
local show_text="#[fg=$background,bg=$color]$text"
|
|
||||||
|
|
||||||
if [ "$status_connect_separator" = "yes" ]; then
|
|
||||||
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
|
|
||||||
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
|
|
||||||
|
|
||||||
else
|
|
||||||
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$window_left_separator"
|
|
||||||
local show_right_separator="#[fg=$color,bg=default]$window_right_separator"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$fill" = "number" ]; then
|
|
||||||
local show_number="#[fg=$background,bg=$color]$number"
|
|
||||||
local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$window_middle_separator"
|
|
||||||
local show_text="#[fg=$thm_fg,bg=$background]$text"
|
|
||||||
|
|
||||||
if [ "$window_number_position" = "right" ]; then
|
|
||||||
if [ "$status_connect_separator" = "yes" ]; then
|
|
||||||
local show_left_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
|
|
||||||
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
|
|
||||||
|
|
||||||
else
|
|
||||||
local show_left_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$window_left_separator"
|
|
||||||
local show_right_separator="#[fg=$color,bg=default]$window_right_separator"
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$window_number_position" = "left" ]; then
|
|
||||||
if [ "$status_connect_separator" = "yes" ]; then
|
|
||||||
local show_right_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_right_separator"
|
|
||||||
local show_left_separator="#[fg=$color,bg=$thm_bg]$window_left_separator"
|
|
||||||
|
|
||||||
else
|
|
||||||
local show_right_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$window_right_separator"
|
|
||||||
local show_left_separator="#[fg=$color,bg=default]$window_left_separator"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
local final_window_format
|
|
||||||
|
|
||||||
if [ "$window_number_position" = "right" ]; then
|
|
||||||
final_window_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$window_number_position" = "left" ]; then
|
|
||||||
final_window_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$final_window_format"
|
|
||||||
}
|
|
||||||
|
|
||||||
prepend_separator() {
|
|
||||||
local field="$1"
|
|
||||||
|
|
||||||
echo "${field:+ $field}"
|
|
||||||
}
|
|
||||||
|
|
||||||
build_window_icon() {
|
|
||||||
# Only update `show_window_status` if it's not empty
|
|
||||||
# this module is ran twice once for current and once for default
|
|
||||||
# meaning 2 calls to build_window_icon wich will/should both return the same
|
|
||||||
# result.
|
|
||||||
if [ -z "$show_window_status" ]; then
|
|
||||||
local custom_icon_window_last \
|
|
||||||
custom_icon_window_zoom custom_icon_window_mark custom_icon_window_mark \
|
|
||||||
custom_icon_window_silent custom_icon_window_activity custom_icon_window_bell
|
|
||||||
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
local tmux_batch_options_commands=()
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
local tmux_batch_options=()
|
|
||||||
|
|
||||||
add_tmux_batch_option "@catppuccin_icon_window_last"
|
|
||||||
add_tmux_batch_option "@catppuccin_icon_window_current"
|
|
||||||
add_tmux_batch_option "@catppuccin_icon_window_zoom"
|
|
||||||
add_tmux_batch_option "@catppuccin_icon_window_mark"
|
|
||||||
add_tmux_batch_option "@catppuccin_icon_window_silent"
|
|
||||||
add_tmux_batch_option "@catppuccin_icon_window_activity"
|
|
||||||
add_tmux_batch_option "@catppuccin_icon_window_bell"
|
|
||||||
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
custom_icon_window_last=$(get_tmux_batch_option "@catppuccin_icon_window_last" "")
|
|
||||||
custom_icon_window_current=$(get_tmux_batch_option "@catppuccin_icon_window_current" "")
|
|
||||||
custom_icon_window_zoom=$(get_tmux_batch_option "@catppuccin_icon_window_zoom" "")
|
|
||||||
custom_icon_window_mark=$(get_tmux_batch_option "@catppuccin_icon_window_mark" "")
|
|
||||||
custom_icon_window_silent=$(get_tmux_batch_option "@catppuccin_icon_window_silent" "")
|
|
||||||
custom_icon_window_activity=$(get_tmux_batch_option "@catppuccin_icon_window_activity" "")
|
|
||||||
custom_icon_window_bell=$(get_tmux_batch_option "@catppuccin_icon_window_bell" "")
|
|
||||||
|
|
||||||
if [ "$window_status" = "icon" ]; then
|
|
||||||
# icon order: #!~[*-]MZ
|
|
||||||
show_window_status=""
|
|
||||||
show_window_status+="#{?window_activity_flag,$(prepend_separator "${custom_icon_window_activity}"),}"
|
|
||||||
show_window_status+="#{?window_bell_flag,$(prepend_separator "${custom_icon_window_bell}"),}"
|
|
||||||
show_window_status+="#{?window_silence_flag,$(prepend_separator "${custom_icon_window_silent}"),}"
|
|
||||||
show_window_status+="#{?window_active,$(prepend_separator "${custom_icon_window_current}"),}"
|
|
||||||
show_window_status+="#{?window_last_flag,$(prepend_separator "${custom_icon_window_last}"),}"
|
|
||||||
show_window_status+="#{?window_marked_flag,$(prepend_separator "${custom_icon_window_mark}"),}"
|
|
||||||
show_window_status+="#{?window_zoomed_flag,$(prepend_separator "${custom_icon_window_zoom}"),}"
|
|
||||||
elif [ "$window_status" = "text" ]; then
|
|
||||||
show_window_status=" #F"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$show_window_status"
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
# User Defined Modules
|
|
||||||
|
|
||||||
This folder is used to store user defined modules. You can use this folder to
|
|
||||||
add a new module or override any existing module. To override an existing
|
|
||||||
module, make sure that you use the same name for your module as the module you
|
|
||||||
want to override. You can also override the window module for the current and
|
|
||||||
default window.
|
|
||||||
|
|
||||||
## Creating A New Module
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> Changes will only be applied after reloading your Tmux configuration by executing `tmux source-file ~/.tmux.conf`.
|
|
||||||
|
|
||||||
You can create a custom module by following the steps outlined below. This can be something you create entirely by yourself or integrating an existing Tmux plugin.
|
|
||||||
|
|
||||||
1. Create a new file in `~/.tmux/plugins/tmux/custom/<module_name>.sh` to store the custom module.
|
|
||||||
- The file **must** end in `.sh`
|
|
||||||
- The file **does not** need to be set as executable.
|
|
||||||
|
|
||||||
2. Copy the following template to this new file. Make sure to replace every instance of `<module_name>` by the name you chose as filename.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# If this module depends on an external Tmux plugin, say so in a comment.
|
|
||||||
# E.g.: Requires https://github.com/aaronpowell/tmux-weather
|
|
||||||
|
|
||||||
show_<module_name>() { # This function name must match the module name!
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
index=$1 # This variable is used internally by the module loader in order to know the position of this module
|
|
||||||
|
|
||||||
icon="$( get_tmux_option "@catppuccin_<module_name>_icon" "" )"
|
|
||||||
color="$( get_tmux_option "@catppuccin_<module_name>_color" "$thm_orange" )"
|
|
||||||
text="$( get_tmux_option "@catppuccin_<module_name>_text" "hello world" )"
|
|
||||||
|
|
||||||
module=$( build_status_module "$index" "$icon" "$color" "$text" )
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Add the custom module to the list of modules in `.tmux.conf`
|
|
||||||
|
|
||||||
```bash
|
|
||||||
set -g @catppuccin_status_modules_right "... <module_name> ..."
|
|
||||||
```
|
|
||||||
|
|
||||||
## Customization
|
|
||||||
|
|
||||||
Change the icon to one from [Nerd Fonts](https://www.nerdfonts.com/cheat-sheet).
|
|
||||||
|
|
||||||
Change the color to one of the [official colors](../catppuccin-macchiato.tmuxtheme), for instance `"$thm_cyan"`, or to a hexadecimal color like `"#00ff00"`.
|
|
||||||
|
|
||||||
The text to display can either be:
|
|
||||||
|
|
||||||
- A static text, e.g. `"hello world"`.
|
|
||||||
- The output of a command, e.g. `"#( date +%T )"`.
|
|
||||||
- The output of a script, e.g. `"#( $HOME/my_script.sh )"` . Any script will do, e.g. a Bash or Python script that prints some text, but ensure that it is executable: `chmod u+x my_script.sh`.
|
|
||||||
- An existing Tmux plugin, e.g. `" #{forecast} "` for the [Tmux Weather plugin](https://github.com/aaronpowell/tmux-weather).
|
|
||||||
|
|
||||||
Note that the icon and the color can be generated dynamically as well, for instance by having a Bash script `echo` a hexadecimal color.
|
|
||||||
|
|
||||||
To modify how often the modules are updated, add the following to `.tmux.conf`:
|
|
||||||
|
|
||||||
```tmux
|
|
||||||
set -g status-interval <number of seconds>
|
|
||||||
```
|
|
||||||
|
|
||||||
To configure a custom path for your modules, set this option:
|
|
||||||
|
|
||||||
```tmux
|
|
||||||
set -g @catppuccin_custom_plugin_dir "<path>"
|
|
||||||
```
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
# If this module depends on an external Tmux plugin, say so in a comment.
|
|
||||||
# E.g.: Requires https://github.com/aaronpowell/tmux-weather
|
|
||||||
|
|
||||||
show_test() { # This function name must match the module name!
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
index=$1 # This variable is used internally by the module loader in order to know the position of this module
|
|
||||||
icon="$( get_tmux_option "@catppuccin_test_icon" "" )"
|
|
||||||
color="$( get_tmux_option "@catppuccin_test_color" "$thm_orange" )"
|
|
||||||
text="$( get_tmux_option "@catppuccin_test_text" "hello world" )"
|
|
||||||
|
|
||||||
module=$( build_status_module "$index" "$icon" "$color" "$text" )
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
show_pane_default_format() {
|
|
||||||
local number color background text fill
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
local tmux_batch_options_commands=()
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
local tmux_batch_options=()
|
|
||||||
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_color"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_background_color"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_default_text"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_default_fill"
|
|
||||||
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
number="#{pane_index}"
|
|
||||||
color="$(get_tmux_batch_option "@catppuccin_pane_color" "$thm_green")"
|
|
||||||
background="$(get_tmux_batch_option "@catppuccin_pane_background_color" "$thm_gray")"
|
|
||||||
text="$(get_tmux_batch_option "@catppuccin_pane_default_text" "#{b:pane_current_path}")"
|
|
||||||
fill="$(get_tmux_batch_option "@catppuccin_pane_default_fill" "number")" # number, all, none
|
|
||||||
|
|
||||||
default_pane_format=$(build_pane_format "$number" "$color" "$background" "$text" "$fill")
|
|
||||||
|
|
||||||
echo "$default_pane_format"
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
"extends": [
|
|
||||||
"local>catppuccin/renovate-config"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
show_application() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "application"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
show_battery() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "battery"
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
# Requires https://github.com/vascomfnunes/tmux-clima
|
|
||||||
show_clima() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "clima"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
show_cpu() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "cpu"
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
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_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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
show_directory() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "directory"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Requires https://github.com/arl/gitmux
|
|
||||||
|
|
||||||
show_gitmux() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "gitmux"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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" )
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
show_host() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "host"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
# Requires https://github.com/jonmosco/kube-tmux
|
|
||||||
|
|
||||||
show_kube() {
|
|
||||||
local index icon color text context_color namespace_color symbol_enabled module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "kube"
|
|
||||||
|
|
||||||
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,15 +0,0 @@
|
|||||||
show_load() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "load"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Requires https://github.com/olimorris/tmux-pomodoro-plus
|
|
||||||
|
|
||||||
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_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" )
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
show_session() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "session"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
show_uptime() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "uptime"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
show_user() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "user"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Requires https://github.com/xamut/tmux-weather.
|
|
||||||
|
|
||||||
show_weather() {
|
|
||||||
local index icon color text module
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module "weather"
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
index=$1
|
|
||||||
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")
|
|
||||||
|
|
||||||
echo "$module"
|
|
||||||
}
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Set path of script
|
|
||||||
PLUGIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
||||||
|
|
||||||
# import
|
|
||||||
# shellcheck source=./builder/module_builder.sh
|
|
||||||
source "${PLUGIN_DIR}/builder/module_builder.sh"
|
|
||||||
# shellcheck source=./builder/window_builder.sh
|
|
||||||
source "${PLUGIN_DIR}/builder/window_builder.sh"
|
|
||||||
# shellcheck source=./builder/pane_builder.sh
|
|
||||||
source "${PLUGIN_DIR}/builder/pane_builder.sh"
|
|
||||||
# shellcheck source=./utils/tmux_utils.sh
|
|
||||||
source "${PLUGIN_DIR}/utils/tmux_utils.sh"
|
|
||||||
# shellcheck source=./utils/interpolate_utils.sh
|
|
||||||
source "${PLUGIN_DIR}/utils/interpolate_utils.sh"
|
|
||||||
# shellcheck source=./utils/module_utils.sh
|
|
||||||
source "${PLUGIN_DIR}/utils/module_utils.sh"
|
|
||||||
|
|
||||||
main() {
|
|
||||||
# Aggregate all commands in one array
|
|
||||||
local tmux_commands=()
|
|
||||||
|
|
||||||
# Aggregate all tmux option for tmux_batch_option
|
|
||||||
local tmux_batch_options_commands=()
|
|
||||||
local tmux_batch_options=()
|
|
||||||
|
|
||||||
# Batch options for loading the colorscheme and everyting before
|
|
||||||
add_tmux_batch_option "@catppuccin_custom_plugin_dir"
|
|
||||||
add_tmux_batch_option "@catppuccin_flavor"
|
|
||||||
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
# module directories
|
|
||||||
local custom_path modules_custom_path modules_status_path modules_window_path modules_pane_path
|
|
||||||
custom_path="$(get_tmux_batch_option "@catppuccin_custom_plugin_dir" "${PLUGIN_DIR}/custom")"
|
|
||||||
modules_custom_path=$custom_path
|
|
||||||
modules_status_path=$PLUGIN_DIR/status
|
|
||||||
modules_window_path=$PLUGIN_DIR/window
|
|
||||||
modules_pane_path=$PLUGIN_DIR/pane
|
|
||||||
|
|
||||||
# load local theme
|
|
||||||
local theme
|
|
||||||
local color_interpolation=()
|
|
||||||
local color_values=()
|
|
||||||
local temp
|
|
||||||
|
|
||||||
theme="$(get_tmux_batch_option "@catppuccin_flavor" "")"
|
|
||||||
|
|
||||||
# NOTE: For backwards compatibility remove before 1.0.0 and set default for
|
|
||||||
# `@catppuccin_flavor` from `""` to `"mocha"`
|
|
||||||
if [ -z "$theme" ]; then
|
|
||||||
theme="$(get_tmux_option "@catppuccin_flavour" "")"
|
|
||||||
if [ -n "$theme" ]; then
|
|
||||||
tmux_echo "catppuccin warning: \\\"@catppuccin_flavour\\\" has been deprecated use \\\"@catppuccin_flavor\\\"" 103
|
|
||||||
else
|
|
||||||
theme="mocha"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# NOTE: Pulling in the selected theme by the theme that's being set as local
|
|
||||||
# variables.
|
|
||||||
# https://github.com/dylanaraps/pure-sh-bible#parsing-a-keyval-file
|
|
||||||
# shellcheck source=./catppuccin-frappe.tmuxtheme
|
|
||||||
while IFS='=' read -r key val; do
|
|
||||||
# Skip over lines containing comments.
|
|
||||||
# (Lines starting with '#').
|
|
||||||
[ "${key##\#*}" ] || continue
|
|
||||||
|
|
||||||
# '$key' stores the key.
|
|
||||||
# '$val' stores the value.
|
|
||||||
eval "local $key"="$val"
|
|
||||||
|
|
||||||
# TODO: Find a better way to strip the quotes from `$val`
|
|
||||||
temp="${val%\"}"
|
|
||||||
temp="${temp#\"}"
|
|
||||||
color_interpolation+=("\#{$key}")
|
|
||||||
color_values+=("${temp}")
|
|
||||||
done <"${PLUGIN_DIR}/themes/catppuccin_${theme}.tmuxtheme"
|
|
||||||
|
|
||||||
# Batch options for `./catppuccin.tmux`
|
|
||||||
add_tmux_batch_option "@catppuccin_status_default"
|
|
||||||
add_tmux_batch_option "@catppuccin_status_justify"
|
|
||||||
add_tmux_batch_option "@catppuccin_status_background"
|
|
||||||
add_tmux_batch_option "@catppuccin_menu_style"
|
|
||||||
add_tmux_batch_option "@catppuccin_menu_selected_style"
|
|
||||||
add_tmux_batch_option "@catppuccin_menu_border_style"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_status_enabled"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_border_status"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_border_style"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_active_border_style"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_left_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_middle_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_right_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_pane_number_position"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_left_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_right_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_middle_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_number_position"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_status"
|
|
||||||
add_tmux_batch_option "@catppuccin_status_left_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_status_middle_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_status_right_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_status_connect_separator"
|
|
||||||
add_tmux_batch_option "@catppuccin_status_fill"
|
|
||||||
add_tmux_batch_option "@catppuccin_status_modules_left"
|
|
||||||
add_tmux_batch_option "@catppuccin_status_modules_right"
|
|
||||||
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
# status general
|
|
||||||
local status_default status_justify status_background message_background
|
|
||||||
status_default=$(get_tmux_batch_option "@catppuccin_status_default" "on")
|
|
||||||
# shellcheck disable=SC2121
|
|
||||||
set status "$status_default"
|
|
||||||
|
|
||||||
status_justify=$(get_tmux_batch_option "@catppuccin_status_justify" "left")
|
|
||||||
set status-justify "$status_justify"
|
|
||||||
|
|
||||||
status_background=$(get_tmux_batch_option "@catppuccin_status_background" "theme")
|
|
||||||
if [ "${status_background}" = "theme" ]; then
|
|
||||||
set status-bg "${thm_bg}"
|
|
||||||
message_background="${thm_gray}"
|
|
||||||
else
|
|
||||||
if [ "${status_background}" = "default" ]; then
|
|
||||||
set status-style bg=default
|
|
||||||
message_background="default"
|
|
||||||
else
|
|
||||||
message_background="$(do_color_interpolation "$status_background")"
|
|
||||||
set status-bg "${message_background}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
set status-left-length "100"
|
|
||||||
set status-right-length "100"
|
|
||||||
|
|
||||||
# messages
|
|
||||||
set message-style "fg=${thm_cyan},bg=${message_background},align=centre"
|
|
||||||
set message-command-style "fg=${thm_cyan},bg=${message_background},align=centre"
|
|
||||||
|
|
||||||
# menu
|
|
||||||
local menu_style menu_selected_style menu_border_style
|
|
||||||
menu_style=$(get_interpolated_tmux_batch_option "@catppuccin_menu_style" "default")
|
|
||||||
menu_selected_style=$(get_interpolated_tmux_batch_option "@catppuccin_menu_selected_style" "fg=${thm_gray},bg=${thm_yellow}")
|
|
||||||
menu_border_style=$(get_interpolated_tmux_batch_option "@catppuccin_menu_border_style" "default")
|
|
||||||
set menu-style "$menu_style"
|
|
||||||
set menu-selected-style "$menu_selected_style"
|
|
||||||
set menu-border-style "$menu_border_style"
|
|
||||||
|
|
||||||
# panes
|
|
||||||
local pane_border_status pane_border_style \
|
|
||||||
pane_active_border_style pane_left_separator pane_middle_separator \
|
|
||||||
pane_right_separator pane_number_position pane_format
|
|
||||||
pane_status_enable=$(get_tmux_batch_option "@catppuccin_pane_status_enabled" "no") # yes
|
|
||||||
pane_border_status=$(get_tmux_batch_option "@catppuccin_pane_border_status" "off") # bottom
|
|
||||||
pane_border_style=$(
|
|
||||||
get_interpolated_tmux_batch_option "@catppuccin_pane_border_style" "fg=${thm_gray}"
|
|
||||||
)
|
|
||||||
pane_active_border_style=$(
|
|
||||||
get_interpolated_tmux_batch_option "@catppuccin_pane_active_border_style" \
|
|
||||||
"#{?pane_in_mode,fg=${thm_yellow},#{?pane_synchronized,fg=${thm_magenta},fg=${thm_orange}}}"
|
|
||||||
)
|
|
||||||
pane_left_separator=$(get_tmux_batch_option "@catppuccin_pane_left_separator" "█")
|
|
||||||
pane_middle_separator=$(get_tmux_batch_option "@catppuccin_pane_middle_separator" "█")
|
|
||||||
pane_right_separator=$(get_tmux_batch_option "@catppuccin_pane_right_separator" "█")
|
|
||||||
pane_number_position=$(get_tmux_batch_option "@catppuccin_pane_number_position" "left") # right, left
|
|
||||||
pane_format=$(load_modules "pane_default_format" "$modules_custom_path" "$modules_pane_path")
|
|
||||||
|
|
||||||
setw pane-border-status "$pane_border_status"
|
|
||||||
setw pane-active-border-style "$pane_active_border_style"
|
|
||||||
setw pane-border-style "$pane_border_style"
|
|
||||||
setw pane-border-format "$(do_color_interpolation "$pane_format")"
|
|
||||||
|
|
||||||
# window
|
|
||||||
local window_status_separator window_left_separator window_right_separator \
|
|
||||||
window_middle_separator window_number_position window_status_enable \
|
|
||||||
window_format window_current_format
|
|
||||||
|
|
||||||
window_status_separator=$(get_interpolated_tmux_batch_option "@catppuccin_window_separator" "")
|
|
||||||
setw window-status-separator "$window_status_separator"
|
|
||||||
|
|
||||||
window_left_separator=$(get_tmux_batch_option "@catppuccin_window_left_separator" "█")
|
|
||||||
window_right_separator=$(get_tmux_batch_option "@catppuccin_window_right_separator" "█")
|
|
||||||
window_middle_separator=$(get_tmux_batch_option "@catppuccin_window_middle_separator" "█ ")
|
|
||||||
window_number_position=$(get_tmux_batch_option "@catppuccin_window_number_position" "left") # right, left
|
|
||||||
|
|
||||||
# NOTE: update default to `"no"` when removing the backwards compatibility for
|
|
||||||
# `@catppuccin_window_status_enable` and
|
|
||||||
# `@catppuccin_window_status_icon_enable` in ./builder/window_builder.sh
|
|
||||||
window_status=$(get_tmux_batch_option "@catppuccin_window_status" "no") # no, icon, text
|
|
||||||
|
|
||||||
window_format=$(load_modules "window_default_format" "$modules_custom_path" "$modules_window_path")
|
|
||||||
setw window-status-format "$(do_color_interpolation "$window_format")"
|
|
||||||
|
|
||||||
window_current_format=$(load_modules "window_current_format" "$modules_custom_path" "$modules_window_path")
|
|
||||||
setw window-status-current-format "$(do_color_interpolation "$window_current_format")"
|
|
||||||
|
|
||||||
# status module
|
|
||||||
local status_left_separator status_middle_separator status_right_separator status_connect_separator \
|
|
||||||
status_fill status_modules_left status_modules_right
|
|
||||||
status_left_separator=$(get_tmux_batch_option "@catppuccin_status_left_separator" "")
|
|
||||||
status_right_separator=$(get_tmux_batch_option "@catppuccin_status_right_separator" "█")
|
|
||||||
status_middle_separator=$(get_tmux_batch_option "@catppuccin_status_middle_separator" "")
|
|
||||||
status_connect_separator=$(get_tmux_batch_option "@catppuccin_status_connect_separator" "yes")
|
|
||||||
status_fill=$(get_tmux_batch_option "@catppuccin_status_fill" "icon")
|
|
||||||
|
|
||||||
status_modules_left=$(get_tmux_batch_option "@catppuccin_status_modules_left" "")
|
|
||||||
loaded_modules_left=$(load_modules "$status_modules_left" "$modules_custom_path" "$modules_status_path")
|
|
||||||
set status-left "$(do_color_interpolation "$loaded_modules_left")"
|
|
||||||
|
|
||||||
status_modules_right=$(get_tmux_batch_option "@catppuccin_status_modules_right" "application session")
|
|
||||||
loaded_modules_right=$(load_modules "$status_modules_right" "$modules_custom_path" "$modules_status_path")
|
|
||||||
set status-right "$(do_color_interpolation "$loaded_modules_right")"
|
|
||||||
|
|
||||||
# modes
|
|
||||||
setw clock-mode-colour "${thm_blue}"
|
|
||||||
setw mode-style "fg=${thm_pink} bg=${thm_black4} bold"
|
|
||||||
|
|
||||||
tmux "${tmux_commands[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# NOTE: you can use vars with $<var> and ${<var>} as long as the str is double quoted: ""
|
|
||||||
# WARNING: hex colors can't contain capital letters
|
|
||||||
|
|
||||||
# --> Adwaita
|
|
||||||
thm_bg="#1f1f1f"
|
|
||||||
thm_fg="#ffffff"
|
|
||||||
thm_cyan="#2aa1b3"
|
|
||||||
thm_black="#242424"
|
|
||||||
thm_gray="#303030"
|
|
||||||
thm_magenta="#a347ba"
|
|
||||||
thm_pink="#a347ba"
|
|
||||||
thm_red="#c01c28"
|
|
||||||
thm_green="#26a269"
|
|
||||||
thm_yellow="#a2734c"
|
|
||||||
thm_blue="#2a7bde"
|
|
||||||
thm_orange="#a2734c"
|
|
||||||
thm_black4="#1f1f1f"
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
whiskers:
|
|
||||||
version: "2.1.1"
|
|
||||||
matrix:
|
|
||||||
- flavor
|
|
||||||
filename: "themes/catppuccin_{{flavor.identifier}}.tmuxtheme"
|
|
||||||
---
|
|
||||||
{%- set palette = flavor.colors -%}
|
|
||||||
# NOTE: you can use vars with $<var> and ${<var>} as long as the str is double quoted: ""
|
|
||||||
# WARNING: hex colors can't contain capital letters
|
|
||||||
|
|
||||||
# --> Catppuccin ({{ flavor.identifier | capitalize }})
|
|
||||||
thm_bg="#{{ palette.base.hex | lower }}"
|
|
||||||
thm_fg="#{{ palette.text.hex | lower }}"
|
|
||||||
thm_cyan="#{{ palette.sky.hex| lower }}"
|
|
||||||
thm_black="#{{ palette.mantle.hex | lower }}"
|
|
||||||
thm_gray="#{{ palette.surface0.hex | lower }}"
|
|
||||||
thm_magenta="#{{ palette.mauve.hex | lower }}"
|
|
||||||
thm_pink="#{{ palette.pink.hex | lower }}"
|
|
||||||
thm_red="#{{ palette.red.hex | lower }}"
|
|
||||||
thm_green="#{{ palette.green.hex | lower }}"
|
|
||||||
thm_yellow="#{{ palette.yellow.hex | lower }}"
|
|
||||||
thm_blue="#{{ palette.blue.hex | lower }}"
|
|
||||||
thm_orange="#{{ palette.peach.hex | lower }}"
|
|
||||||
thm_black4="#{{ palette.surface2.hex | lower }}"
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
do_color_interpolation() {
|
|
||||||
local all_interpolated="$1"
|
|
||||||
|
|
||||||
for ((i=0; i<${#color_interpolation[@]}; i++)); do
|
|
||||||
all_interpolated=${all_interpolated//${color_interpolation[$i]}/${color_values[$i]}}
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "$all_interpolated"
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
load_modules() {
|
|
||||||
local modules_list=$1
|
|
||||||
shift
|
|
||||||
local module_directories=("$@")
|
|
||||||
|
|
||||||
local -i module_index=0;
|
|
||||||
local module_name
|
|
||||||
local module_path
|
|
||||||
local loaded_modules
|
|
||||||
local IN=$modules_list
|
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/918886/how-do-i-split-a-string-on-a-delimiter-in-bash#15988793
|
|
||||||
while [ "$IN" != "$iter" ] ;do
|
|
||||||
# extract the substring from start of string up to delimiter.
|
|
||||||
iter=${IN%% *}
|
|
||||||
# delete this first "element" AND next separator, from $IN.
|
|
||||||
IN="${IN#"$iter "}"
|
|
||||||
# Print (or doing anything with) the first "element".
|
|
||||||
|
|
||||||
module_name=$iter
|
|
||||||
|
|
||||||
for module_dir in "${module_directories[@]}" ; do
|
|
||||||
module_path="$module_dir/$module_name.sh"
|
|
||||||
|
|
||||||
if [ -r "$module_path" ]; then
|
|
||||||
# shellcheck source=/dev/null
|
|
||||||
source "$module_path"
|
|
||||||
loaded_modules="$loaded_modules$( "show_$module_name" "$module_index" )"
|
|
||||||
module_index+=1
|
|
||||||
continue 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -z "${module_name/ }" ]]; then
|
|
||||||
if [[ -z "${modules_list/ }" ]]; then
|
|
||||||
tmux_echo "catppuccin warning: a module list has only white space, to remove all modules set it to \\\"null\\\"" 100
|
|
||||||
else
|
|
||||||
tmux_echo "catppuccin warning: a module list with value \\\"$modules_list\\\" has leading/trailing whitespace" 101
|
|
||||||
fi
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
tmux_echo "catppuccin warning: module $module_name not found" 102
|
|
||||||
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "$loaded_modules"
|
|
||||||
}
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
tmux_echo() {
|
|
||||||
local hook
|
|
||||||
hook="after-new-session[$2]"
|
|
||||||
|
|
||||||
tmux set-hook -g "$hook" "run-shell 'echo -e \"$1\"'; set-hook -gu \"$hook\""
|
|
||||||
}
|
|
||||||
|
|
||||||
get_tmux_option() {
|
|
||||||
local option value default
|
|
||||||
option="$1"
|
|
||||||
default="$2"
|
|
||||||
value=$(tmux show-option -gqv "$option")
|
|
||||||
|
|
||||||
if [ -n "$value" ]
|
|
||||||
then
|
|
||||||
if [ "$value" = "null" ]
|
|
||||||
then
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
echo "$value"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$default"
|
|
||||||
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_interpolated_tmux_option() {
|
|
||||||
local option value default
|
|
||||||
option="$1"
|
|
||||||
default="$2"
|
|
||||||
value=$(tmux show-option -gqv "$option")
|
|
||||||
|
|
||||||
if [ -n "$value" ]
|
|
||||||
then
|
|
||||||
if [ "$value" = "null" ]
|
|
||||||
then
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
do_color_interpolation "$value"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$default"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set() {
|
|
||||||
local option=$1
|
|
||||||
local value=$2
|
|
||||||
tmux_commands+=(set-option -gq "$option" "$value" ";")
|
|
||||||
}
|
|
||||||
|
|
||||||
setw() {
|
|
||||||
local option=$1
|
|
||||||
local value=$2
|
|
||||||
tmux_commands+=(set-window-option -gq "$option" "$value" ";")
|
|
||||||
}
|
|
||||||
|
|
||||||
get_tmux_batch_option() {
|
|
||||||
local option default value
|
|
||||||
option="$1"
|
|
||||||
default="$2"
|
|
||||||
|
|
||||||
for option_index in "${!tmux_batch_options[@]}"; do
|
|
||||||
IFS="" read -r read_option read_value <<<"${tmux_batch_options[$option_index]}"
|
|
||||||
if [[ "$read_option" == "$option" ]]; then
|
|
||||||
echo "$read_value"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "$default"
|
|
||||||
}
|
|
||||||
|
|
||||||
get_interpolated_tmux_batch_option() {
|
|
||||||
local option default value
|
|
||||||
option="$1"
|
|
||||||
default="$2"
|
|
||||||
|
|
||||||
for option_index in "${!tmux_batch_options[@]}"; do
|
|
||||||
IFS="" read -r read_option read_value <<<"${tmux_batch_options[$option_index]}"
|
|
||||||
if [[ "$read_option" == "$option" ]]; then
|
|
||||||
do_color_interpolation "$read_value"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "$default"
|
|
||||||
}
|
|
||||||
|
|
||||||
add_tmux_batch_option() {
|
|
||||||
local option
|
|
||||||
option="$1"
|
|
||||||
|
|
||||||
tmux_batch_options_commands+=("show-option -gq $option ;")
|
|
||||||
}
|
|
||||||
|
|
||||||
set_tmux_batch_option() {
|
|
||||||
local option value
|
|
||||||
option="$1"
|
|
||||||
value="$2"
|
|
||||||
|
|
||||||
# NOTE: don't check for duplicates just append
|
|
||||||
# for option_index in "${!tmux_batch_options[@]}"; do
|
|
||||||
# read -d '' -r read_option <<<"${tmux_batch_options[$option_index]}"
|
|
||||||
# if [[ "$read_option" == "$option" ]]; then
|
|
||||||
# tmux_batch_options["$option_index"]="$option$value"
|
|
||||||
# return
|
|
||||||
# fi
|
|
||||||
# done
|
|
||||||
|
|
||||||
tmux_batch_options+=("$option$value")
|
|
||||||
}
|
|
||||||
|
|
||||||
run_tmux_batch_commands() {
|
|
||||||
local temp
|
|
||||||
|
|
||||||
# shellcheck disable=SC2048,SC2086,SC2162
|
|
||||||
while IFS=' ' read option value; do
|
|
||||||
if [ -n "$value" ]; then
|
|
||||||
if [ "$value" = "null" ]; then
|
|
||||||
set_tmux_batch_option "$option" ""
|
|
||||||
else
|
|
||||||
temp="${value%\"}"
|
|
||||||
temp="${temp#\"}"
|
|
||||||
set_tmux_batch_option "$option" "$temp"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done < <(tmux ${tmux_batch_options_commands[*]})
|
|
||||||
|
|
||||||
tmux_batch_options_commands=()
|
|
||||||
}
|
|
||||||
|
|
||||||
tmux_batch_setup_status_module() {
|
|
||||||
local name="$1"
|
|
||||||
|
|
||||||
# Don't want to run commands set before since we can't update
|
|
||||||
# `tmux_batch_options` for it
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
tmux_batch_options_commands=()
|
|
||||||
|
|
||||||
# No need to check previous options
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
tmux_batch_options=()
|
|
||||||
|
|
||||||
add_tmux_batch_option "@catppuccin_${name}_icon"
|
|
||||||
add_tmux_batch_option "@catppuccin_${name}_color"
|
|
||||||
add_tmux_batch_option "@catppuccin_${name}_text"
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
show_window_current_format() {
|
|
||||||
local number color background text fill current_window_format
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
local tmux_batch_options_commands=()
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
local tmux_batch_options=()
|
|
||||||
|
|
||||||
add_tmux_batch_option "@catppuccin_window_current_color"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_current_background"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_current_text"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_current_fill"
|
|
||||||
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
number="#I"
|
|
||||||
color=$(get_tmux_batch_option "@catppuccin_window_current_color" "$thm_orange")
|
|
||||||
background=$(get_tmux_batch_option "@catppuccin_window_current_background" "$thm_bg")
|
|
||||||
text="$(get_tmux_batch_option "@catppuccin_window_current_text" "#{b:pane_current_path}")" # use #W for application instead of directory
|
|
||||||
fill="$(get_tmux_batch_option "@catppuccin_window_current_fill" "number")" # number, all, none
|
|
||||||
|
|
||||||
current_window_format=$(build_window_format "$number" "$color" "$background" "$text" "$fill" "current")
|
|
||||||
|
|
||||||
echo "$current_window_format"
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
show_window_default_format() {
|
|
||||||
local number color background text fill default_window_format
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
local tmux_batch_options_commands=()
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
local tmux_batch_options=()
|
|
||||||
|
|
||||||
add_tmux_batch_option "@catppuccin_window_default_color"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_default_background"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_default_text"
|
|
||||||
add_tmux_batch_option "@catppuccin_window_default_fill"
|
|
||||||
|
|
||||||
run_tmux_batch_commands
|
|
||||||
|
|
||||||
number="#I"
|
|
||||||
color=$(get_tmux_batch_option "@catppuccin_window_default_color" "$thm_blue")
|
|
||||||
background=$(get_tmux_batch_option "@catppuccin_window_default_background" "$thm_gray")
|
|
||||||
text="$(get_tmux_batch_option "@catppuccin_window_default_text" "#{b:pane_current_path}")" # use #W for application instead of directory
|
|
||||||
fill="$(get_tmux_batch_option "@catppuccin_window_default_fill" "number")" # number, all, none
|
|
||||||
|
|
||||||
default_window_format=$(build_window_format "$number" "$color" "$background" "$text" "$fill" "default")
|
|
||||||
|
|
||||||
echo "$default_window_format"
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/scripts/helpers.sh"
|
|
||||||
|
|
||||||
battery_interpolation=(
|
|
||||||
"\#{battery_color_bg}"
|
|
||||||
"\#{battery_color_fg}"
|
|
||||||
"\#{battery_color_charge_bg}"
|
|
||||||
"\#{battery_color_charge_fg}"
|
|
||||||
"\#{battery_color_status_bg}"
|
|
||||||
"\#{battery_color_status_fg}"
|
|
||||||
"\#{battery_graph}"
|
|
||||||
"\#{battery_icon}"
|
|
||||||
"\#{battery_icon_charge}"
|
|
||||||
"\#{battery_icon_status}"
|
|
||||||
"\#{battery_percentage}"
|
|
||||||
"\#{battery_remain}"
|
|
||||||
)
|
|
||||||
|
|
||||||
battery_commands=(
|
|
||||||
"#($CURRENT_DIR/scripts/battery_color.sh bg)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_color.sh fg)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_color_charge.sh bg)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_color_charge.sh fg)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_color_status.sh bg)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_color_status.sh fg)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_graph.sh)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_icon.sh)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_icon_charge.sh)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_icon_status.sh)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_percentage.sh)"
|
|
||||||
"#($CURRENT_DIR/scripts/battery_remain.sh)"
|
|
||||||
)
|
|
||||||
|
|
||||||
set_tmux_option() {
|
|
||||||
local option="$1"
|
|
||||||
local value="$2"
|
|
||||||
tmux set-option -gq "$option" "$value"
|
|
||||||
}
|
|
||||||
|
|
||||||
do_interpolation() {
|
|
||||||
local all_interpolated="$1"
|
|
||||||
for ((i=0; i<${#battery_commands[@]}; i++)); do
|
|
||||||
all_interpolated=${all_interpolated//${battery_interpolation[$i]}/${battery_commands[$i]}}
|
|
||||||
done
|
|
||||||
echo "$all_interpolated"
|
|
||||||
}
|
|
||||||
|
|
||||||
update_tmux_option() {
|
|
||||||
local option="$1"
|
|
||||||
local option_value="$(get_tmux_option "$option")"
|
|
||||||
local new_option_value="$(do_interpolation "$option_value")"
|
|
||||||
set_tmux_option "$option" "$new_option_value"
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
update_tmux_option "status-right"
|
|
||||||
update_tmux_option "status-left"
|
|
||||||
}
|
|
||||||
main
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
print_color() {
|
|
||||||
local plane="$1"
|
|
||||||
local status="$2"
|
|
||||||
if [ "$status" == "discharging" ]; then
|
|
||||||
$CURRENT_DIR/battery_color_charge.sh "$plane"
|
|
||||||
else
|
|
||||||
$CURRENT_DIR/battery_color_status.sh "$plane" "$status"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local status="$(battery_status)"
|
|
||||||
local plane="$1"
|
|
||||||
print_color "$plane" "$status"
|
|
||||||
}
|
|
||||||
|
|
||||||
main $@
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
# script global variables
|
|
||||||
color_charge_primary_tier8=''
|
|
||||||
color_charge_primary_tier7=''
|
|
||||||
color_charge_primary_tier6=''
|
|
||||||
color_charge_primary_tier5=''
|
|
||||||
color_charge_primary_tier4=''
|
|
||||||
color_charge_primary_tier3=''
|
|
||||||
color_charge_primary_tier2=''
|
|
||||||
color_charge_primary_tier1=''
|
|
||||||
color_charge_secondary_tier8=''
|
|
||||||
color_charge_secondary_tier7=''
|
|
||||||
color_charge_secondary_tier6=''
|
|
||||||
color_charge_secondary_tier5=''
|
|
||||||
color_charge_secondary_tier4=''
|
|
||||||
color_charge_secondary_tier3=''
|
|
||||||
color_charge_secondary_tier2=''
|
|
||||||
color_charge_secondary_tier1=''
|
|
||||||
|
|
||||||
# script default variables
|
|
||||||
color_charge_primary_tier8_default='#00ff00'
|
|
||||||
color_charge_primary_tier7_default='#55ff00'
|
|
||||||
color_charge_primary_tier6_default='#aaff00'
|
|
||||||
color_charge_primary_tier5_default='#ffff00'
|
|
||||||
color_charge_primary_tier4_default='#ffc000'
|
|
||||||
color_charge_primary_tier3_default='#ff8000'
|
|
||||||
color_charge_primary_tier2_default='#ff4000'
|
|
||||||
color_charge_primary_tier1_default='#ff0000'
|
|
||||||
color_charge_secondary_tier8_default='colour0'
|
|
||||||
color_charge_secondary_tier7_default='colour0'
|
|
||||||
color_charge_secondary_tier6_default='colour0'
|
|
||||||
color_charge_secondary_tier5_default='colour0'
|
|
||||||
color_charge_secondary_tier4_default='colour0'
|
|
||||||
color_charge_secondary_tier3_default='colour0'
|
|
||||||
color_charge_secondary_tier2_default='colour0'
|
|
||||||
color_charge_secondary_tier1_default='colour0'
|
|
||||||
|
|
||||||
# colors are set as script global variables
|
|
||||||
get_color_charge_settings() {
|
|
||||||
color_charge_primary_tier8=$(get_tmux_option "@batt_color_charge_primary_tier8" "$color_charge_primary_tier8_default")
|
|
||||||
color_charge_primary_tier7=$(get_tmux_option "@batt_color_charge_primary_tier7" "$color_charge_primary_tier7_default")
|
|
||||||
color_charge_primary_tier6=$(get_tmux_option "@batt_color_charge_primary_tier6" "$color_charge_primary_tier6_default")
|
|
||||||
color_charge_primary_tier5=$(get_tmux_option "@batt_color_charge_primary_tier5" "$color_charge_primary_tier5_default")
|
|
||||||
color_charge_primary_tier4=$(get_tmux_option "@batt_color_charge_primary_tier4" "$color_charge_primary_tier4_default")
|
|
||||||
color_charge_primary_tier3=$(get_tmux_option "@batt_color_charge_primary_tier3" "$color_charge_primary_tier3_default")
|
|
||||||
color_charge_primary_tier2=$(get_tmux_option "@batt_color_charge_primary_tier2" "$color_charge_primary_tier2_default")
|
|
||||||
color_charge_primary_tier1=$(get_tmux_option "@batt_color_charge_primary_tier1" "$color_charge_primary_tier1_default")
|
|
||||||
color_charge_secondary_tier8=$(get_tmux_option "@batt_color_charge_secondary_tier8" "$color_charge_secondary_tier8_default")
|
|
||||||
color_charge_secondary_tier7=$(get_tmux_option "@batt_color_charge_secondary_tier7" "$color_charge_secondary_tier7_default")
|
|
||||||
color_charge_secondary_tier6=$(get_tmux_option "@batt_color_charge_secondary_tier6" "$color_charge_secondary_tier6_default")
|
|
||||||
color_charge_secondary_tier5=$(get_tmux_option "@batt_color_charge_secondary_tier5" "$color_charge_secondary_tier5_default")
|
|
||||||
color_charge_secondary_tier4=$(get_tmux_option "@batt_color_charge_secondary_tier4" "$color_charge_secondary_tier4_default")
|
|
||||||
color_charge_secondary_tier3=$(get_tmux_option "@batt_color_charge_secondary_tier3" "$color_charge_secondary_tier3_default")
|
|
||||||
color_charge_secondary_tier2=$(get_tmux_option "@batt_color_charge_secondary_tier2" "$color_charge_secondary_tier2_default")
|
|
||||||
color_charge_secondary_tier1=$(get_tmux_option "@batt_color_charge_secondary_tier1" "$color_charge_secondary_tier1_default")
|
|
||||||
}
|
|
||||||
|
|
||||||
print_color_charge() {
|
|
||||||
local primary_plane="$1"
|
|
||||||
local secondary_plane=""
|
|
||||||
if [ "$primary_plane" == "bg" ]; then
|
|
||||||
secondary_plane="fg"
|
|
||||||
else
|
|
||||||
secondary_plane="bg"
|
|
||||||
fi
|
|
||||||
percentage=$($CURRENT_DIR/battery_percentage.sh | sed -e 's/%//')
|
|
||||||
if [ $percentage -ge 95 -o "$percentage" == "" ]; then
|
|
||||||
# if percentage is empty, assume it's a desktop
|
|
||||||
printf "#[$primary_plane=$color_charge_primary_tier8${color_charge_secondary_tier8:+",$secondary_plane=$color_charge_secondary_tier8"}]"
|
|
||||||
elif [ $percentage -ge 80 ]; then
|
|
||||||
printf "#[$primary_plane=$color_charge_primary_tier7${color_charge_secondary_tier7:+",$secondary_plane=$color_charge_secondary_tier7"}]"
|
|
||||||
elif [ $percentage -ge 65 ]; then
|
|
||||||
printf "#[$primary_plane=$color_charge_primary_tier6${color_charge_secondary_tier6:+",$secondary_plane=$color_charge_secondary_tier6"}]"
|
|
||||||
elif [ $percentage -ge 50 ]; then
|
|
||||||
printf "#[$primary_plane=$color_charge_primary_tier5${color_charge_secondary_tier5:+",$secondary_plane=$color_charge_secondary_tier5"}]"
|
|
||||||
elif [ $percentage -ge 35 ]; then
|
|
||||||
printf "#[$primary_plane=$color_charge_primary_tier4${color_charge_secondary_tier4:+",$secondary_plane=$color_charge_secondary_tier4"}]"
|
|
||||||
elif [ $percentage -ge 20 ]; then
|
|
||||||
printf "#[$primary_plane=$color_charge_primary_tier3${color_charge_secondary_tier3:+",$secondary_plane=$color_charge_secondary_tier3"}]"
|
|
||||||
elif [ $percentage -gt 5 ]; then
|
|
||||||
printf "#[$primary_plane=$color_charge_primary_tier2${color_charge_secondary_tier2:+",$secondary_plane=$color_charge_secondary_tier2"}]"
|
|
||||||
else
|
|
||||||
printf "#[$primary_plane=$color_charge_primary_tier1${color_charge_secondary_tier1:+",$secondary_plane=$color_charge_secondary_tier1"}]"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local plane="$1"
|
|
||||||
get_color_charge_settings
|
|
||||||
print_color_charge "$plane"
|
|
||||||
}
|
|
||||||
|
|
||||||
main $@
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
# script global variables
|
|
||||||
color_status_primary_charged=''
|
|
||||||
color_status_primary_charging=''
|
|
||||||
color_status_primary_discharging=''
|
|
||||||
color_status_primary_attached=''
|
|
||||||
color_status_primary_unknown=''
|
|
||||||
color_status_secondary_charged=''
|
|
||||||
color_status_secondary_charging=''
|
|
||||||
color_status_secondary_discharging=''
|
|
||||||
color_status_secondary_attached=''
|
|
||||||
color_status_secondary_unknown=''
|
|
||||||
|
|
||||||
# script default variables
|
|
||||||
color_status_primary_charged_default='colour33'
|
|
||||||
color_status_primary_charging_default='colour33'
|
|
||||||
color_status_primary_discharging_default='colour14'
|
|
||||||
color_status_primary_attached_default='colour201'
|
|
||||||
color_status_primary_unknown_default='colour7'
|
|
||||||
color_status_secondary_charged_default='colour0'
|
|
||||||
color_status_secondary_charging_default='colour0'
|
|
||||||
color_status_secondary_discharging_default='colour0'
|
|
||||||
color_status_secondary_attached_default='colour0'
|
|
||||||
color_status_secondary_unknown_default='colour0'
|
|
||||||
|
|
||||||
# colors are set as script global variables
|
|
||||||
get_color_status_settings() {
|
|
||||||
color_status_primary_charged=$(get_tmux_option "@batt_color_status_primary_charged" "$color_status_primary_charged_default")
|
|
||||||
color_status_primary_charging=$(get_tmux_option "@batt_color_status_primary_charging" "$color_status_primary_charging_default")
|
|
||||||
color_status_primary_discharging=$(get_tmux_option "@batt_color_status_primary_discharging" "$color_status_primary_discharging_default")
|
|
||||||
color_status_primary_attached=$(get_tmux_option "@batt_color_status_primary_attached" "$color_status_primary_attached_default")
|
|
||||||
color_status_primary_unknown=$(get_tmux_option "@batt_color_status_primary_unknown" "$color_status_primary_unknown_default")
|
|
||||||
color_status_secondary_charged=$(get_tmux_option "@batt_color_status_secondary_charged" "$color_status_secondary_charged_default")
|
|
||||||
color_status_secondary_charging=$(get_tmux_option "@batt_color_status_secondary_charging" "$color_status_secondary_charging_default")
|
|
||||||
color_status_secondary_discharging=$(get_tmux_option "@batt_color_status_secondary_discharging" "$color_status_secondary_discharging_default")
|
|
||||||
color_status_secondary_attached=$(get_tmux_option "@batt_color_status_secondary_attached" "$color_status_secondary_attached_default")
|
|
||||||
color_status_secondary_unknown=$(get_tmux_option "@batt_color_status_secondary_unknown" "$color_status_secondary_unknown_default")
|
|
||||||
}
|
|
||||||
|
|
||||||
print_color_status() {
|
|
||||||
local plane_primary="$1"
|
|
||||||
local plane_secondary=""
|
|
||||||
if [ "$plane_primary" == "bg" ]; then
|
|
||||||
plane_secondary="fg"
|
|
||||||
else
|
|
||||||
plane_secondary="bg"
|
|
||||||
fi
|
|
||||||
local status="$2"
|
|
||||||
if [[ $status =~ (charged) || $status =~ (full) ]]; then
|
|
||||||
printf "#[$plane_primary=$color_status_primary_charged${color_status_secondary_charged:+",$plane_secondary=$color_status_secondary_charged"}]"
|
|
||||||
elif [[ $status =~ (^charging) ]]; then
|
|
||||||
printf "#[$plane_primary=$color_status_primary_charging${color_status_secondary_charging:+",$plane_secondary=$color_status_secondary_charging"}]"
|
|
||||||
elif [[ $status =~ (^discharging) ]]; then
|
|
||||||
printf "#[$plane_primary=$color_status_primary_discharging${color_status_secondary_discharging:+",$plane_secondary=$color_status_secondary_discharging"}]"
|
|
||||||
elif [[ $status =~ (attached) ]]; then
|
|
||||||
printf "#[$plane_primary=$color_status_primary_attached${color_status_secondary_attached:+",$plane_secondary=$color_status_secondary_attached"}]"
|
|
||||||
else
|
|
||||||
printf "#[$plane_primary=$color_status_primary_unknown${color_status_secondary_unknown:+",$plane_secondary=$color_status_secondary_unknown"}]"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local plane="$1"
|
|
||||||
local status=${2:-$(battery_status)}
|
|
||||||
get_color_status_settings
|
|
||||||
print_color_status "$plane" "$status"
|
|
||||||
}
|
|
||||||
|
|
||||||
main $@
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
print_graph() {
|
|
||||||
local percentage=$1
|
|
||||||
if [ $percentage -gt 5 ]; then
|
|
||||||
printf "▁"
|
|
||||||
else
|
|
||||||
printf " "
|
|
||||||
fi
|
|
||||||
if [ $percentage -ge 25 ]; then
|
|
||||||
printf "▂"
|
|
||||||
else
|
|
||||||
printf " "
|
|
||||||
fi
|
|
||||||
if [ $percentage -ge 50 ]; then
|
|
||||||
printf "▄"
|
|
||||||
else
|
|
||||||
printf " "
|
|
||||||
fi
|
|
||||||
if [ $percentage -ge 75 ]; then
|
|
||||||
printf "▆"
|
|
||||||
else
|
|
||||||
printf " "
|
|
||||||
fi
|
|
||||||
if [ $percentage -ge 95 ]; then
|
|
||||||
printf "█"
|
|
||||||
else
|
|
||||||
printf " "
|
|
||||||
echo "▇"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local percentage=$($CURRENT_DIR/battery_percentage.sh)
|
|
||||||
if [ "$(uname)" == "OpenBSD" ]; then
|
|
||||||
print_graph ${percentage}
|
|
||||||
else
|
|
||||||
print_graph ${percentage%?}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
main
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
print_icon() {
|
|
||||||
local status=$1
|
|
||||||
if [ "$status" == "discharging" ]; then
|
|
||||||
$CURRENT_DIR/battery_icon_charge.sh
|
|
||||||
else
|
|
||||||
$CURRENT_DIR/battery_icon_status.sh "$status"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local status=$(battery_status)
|
|
||||||
print_icon "$status"
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
# script global variables
|
|
||||||
icon_charge_tier8=''
|
|
||||||
icon_charge_tier7=''
|
|
||||||
icon_charge_tier6=''
|
|
||||||
icon_charge_tier5=''
|
|
||||||
icon_charge_tier4=''
|
|
||||||
icon_charge_tier3=''
|
|
||||||
icon_charge_tier2=''
|
|
||||||
icon_charge_tier1=''
|
|
||||||
|
|
||||||
# script default variables
|
|
||||||
icon_charge_tier8_default='█'
|
|
||||||
icon_charge_tier7_default='▇'
|
|
||||||
icon_charge_tier6_default='▆'
|
|
||||||
icon_charge_tier5_default='▅'
|
|
||||||
icon_charge_tier4_default='▄'
|
|
||||||
icon_charge_tier3_default='▃'
|
|
||||||
icon_charge_tier2_default='▂'
|
|
||||||
icon_charge_tier1_default='▁'
|
|
||||||
|
|
||||||
# icons are set as script global variables
|
|
||||||
get_icon_charge_settings() {
|
|
||||||
icon_charge_tier8=$(get_tmux_option "@batt_icon_charge_tier8" "$icon_charge_tier8_default")
|
|
||||||
icon_charge_tier7=$(get_tmux_option "@batt_icon_charge_tier7" "$icon_charge_tier7_default")
|
|
||||||
icon_charge_tier6=$(get_tmux_option "@batt_icon_charge_tier6" "$icon_charge_tier6_default")
|
|
||||||
icon_charge_tier5=$(get_tmux_option "@batt_icon_charge_tier5" "$icon_charge_tier5_default")
|
|
||||||
icon_charge_tier4=$(get_tmux_option "@batt_icon_charge_tier4" "$icon_charge_tier4_default")
|
|
||||||
icon_charge_tier3=$(get_tmux_option "@batt_icon_charge_tier3" "$icon_charge_tier3_default")
|
|
||||||
icon_charge_tier2=$(get_tmux_option "@batt_icon_charge_tier2" "$icon_charge_tier2_default")
|
|
||||||
icon_charge_tier1=$(get_tmux_option "@batt_icon_charge_tier1" "$icon_charge_tier1_default")
|
|
||||||
}
|
|
||||||
|
|
||||||
print_icon_charge() {
|
|
||||||
percentage=$($CURRENT_DIR/battery_percentage.sh | sed -e 's/%//')
|
|
||||||
if [ $percentage -ge 95 -o "$percentage" == "" ]; then
|
|
||||||
# if percentage is empty, assume it's a desktop
|
|
||||||
printf "$icon_charge_tier8"
|
|
||||||
elif [ $percentage -ge 80 ]; then
|
|
||||||
printf "$icon_charge_tier7"
|
|
||||||
elif [ $percentage -ge 65 ]; then
|
|
||||||
printf "$icon_charge_tier6"
|
|
||||||
elif [ $percentage -ge 50 ]; then
|
|
||||||
printf "$icon_charge_tier5"
|
|
||||||
elif [ $percentage -ge 35 ]; then
|
|
||||||
printf "$icon_charge_tier4"
|
|
||||||
elif [ $percentage -ge 20 ]; then
|
|
||||||
printf "$icon_charge_tier3"
|
|
||||||
elif [ $percentage -gt 5 ]; then
|
|
||||||
printf "$icon_charge_tier2"
|
|
||||||
else
|
|
||||||
printf "$icon_charge_tier1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
get_icon_charge_settings
|
|
||||||
print_icon_charge
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
# script global variables
|
|
||||||
icon_status_charged=''
|
|
||||||
icon_status_charging=''
|
|
||||||
icon_status_discharging=''
|
|
||||||
icon_status_attached=''
|
|
||||||
icon_status_unknown=''
|
|
||||||
|
|
||||||
# script default variables
|
|
||||||
icon_status_charged_default='🔌'
|
|
||||||
icon_status_charged_default_osx='🔌'
|
|
||||||
icon_status_charging_default='🔌'
|
|
||||||
icon_status_discharging_default='🔋'
|
|
||||||
icon_status_attached_default='⚠️'
|
|
||||||
icon_status_unknown_default='?'
|
|
||||||
|
|
||||||
# determine which charged_default variable to use
|
|
||||||
get_icon_status_charged_default() {
|
|
||||||
if is_osx; then
|
|
||||||
printf "$icon_status_charged_default_osx"
|
|
||||||
else
|
|
||||||
printf "$icon_status_charged_default"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# icons are set as script global variables
|
|
||||||
get_icon_status_settings() {
|
|
||||||
icon_status_charged=$(get_tmux_option "@batt_icon_status_charged" "$(get_icon_status_charged_default)")
|
|
||||||
icon_status_charging=$(get_tmux_option "@batt_icon_status_charging" "$icon_status_charging_default")
|
|
||||||
icon_status_discharging=$(get_tmux_option "@batt_icon_status_discharging" "$icon_status_discharging_default")
|
|
||||||
icon_status_attached=$(get_tmux_option "@batt_icon_status_attached" "$icon_status_attached_default")
|
|
||||||
icon_status_unknown=$(get_tmux_option "@batt_icon_status_unknown" "$icon_status_unknown_default")
|
|
||||||
}
|
|
||||||
|
|
||||||
print_icon_status() {
|
|
||||||
local status=$1
|
|
||||||
if [[ $status =~ (charged) || $status =~ (full) ]]; then
|
|
||||||
printf "$icon_status_charged"
|
|
||||||
elif [[ $status =~ (^charging) ]]; then
|
|
||||||
printf "$icon_status_charging"
|
|
||||||
elif [[ $status =~ (^discharging) ]]; then
|
|
||||||
printf "$icon_status_discharging"
|
|
||||||
elif [[ $status =~ (attached) ]]; then
|
|
||||||
printf "$icon_status_attached"
|
|
||||||
else
|
|
||||||
printf "$icon_status_unknown"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
get_icon_status_settings
|
|
||||||
local status=${1:-$(battery_status)}
|
|
||||||
print_icon_status "$status"
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
print_battery_percentage() {
|
|
||||||
# percentage displayed in the 2nd field of the 2nd row
|
|
||||||
if is_wsl; then
|
|
||||||
local battery
|
|
||||||
battery=$(find /sys/class/power_supply/*/capacity | tail -n1)
|
|
||||||
cat "$battery"
|
|
||||||
elif command_exists "pmset"; then
|
|
||||||
pmset -g batt | grep -o "[0-9]\{1,3\}%"
|
|
||||||
elif command_exists "acpi"; then
|
|
||||||
acpi -b | grep -m 1 -Eo "[0-9]+%"
|
|
||||||
elif command_exists "upower"; then
|
|
||||||
# use DisplayDevice if available otherwise battery
|
|
||||||
local battery=$(upower -e | grep -E 'battery|DisplayDevice'| tail -n1)
|
|
||||||
if [ -z "$battery" ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
local percentage=$(upower -i $battery | awk '/percentage:/ {print $2}')
|
|
||||||
if [ "$percentage" ]; then
|
|
||||||
echo ${percentage%.*%}
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
local energy
|
|
||||||
local energy_full
|
|
||||||
energy=$(upower -i $battery | awk -v nrg="$energy" '/energy:/ {print nrg+$2}')
|
|
||||||
energy_full=$(upower -i $battery | awk -v nrgfull="$energy_full" '/energy-full:/ {print nrgfull+$2}')
|
|
||||||
if [ -n "$energy" ] && [ -n "$energy_full" ]; then
|
|
||||||
echo $energy $energy_full | awk '{printf("%d%%", ($1/$2)*100)}'
|
|
||||||
fi
|
|
||||||
elif command_exists "termux-battery-status"; then
|
|
||||||
termux-battery-status | jq -r '.percentage' | awk '{printf("%d%%", $1)}'
|
|
||||||
elif command_exists "apm"; then
|
|
||||||
apm -l
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
print_battery_percentage
|
|
||||||
}
|
|
||||||
main
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
short=false
|
|
||||||
|
|
||||||
get_remain_settings() {
|
|
||||||
short=$(get_tmux_option "@batt_remain_short" false)
|
|
||||||
}
|
|
||||||
|
|
||||||
battery_discharging() {
|
|
||||||
local status="$(battery_status)"
|
|
||||||
[[ $status =~ (discharging) ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
battery_charged() {
|
|
||||||
local status="$(battery_status)"
|
|
||||||
[[ $status =~ (charged) || $status =~ (full) ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
convertmins() {
|
|
||||||
((h=${1}/60))
|
|
||||||
((m=${1}%60))
|
|
||||||
printf "%02d:%02d\n" $h $m $s
|
|
||||||
}
|
|
||||||
|
|
||||||
apm_battery_remaining_time() {
|
|
||||||
local remaining_time="$(convertmins $(apm -m))"
|
|
||||||
if battery_discharging; then
|
|
||||||
if $short; then
|
|
||||||
echo $remaining_time | awk '{printf "~%s", $1}'
|
|
||||||
else
|
|
||||||
echo $remaining_time | awk '{printf "- %s left", $1}'
|
|
||||||
fi
|
|
||||||
elif battery_charged; then
|
|
||||||
if $short; then
|
|
||||||
echo $remaining_time | awk '{printf "charged", $1}'
|
|
||||||
else
|
|
||||||
echo $remaining_time | awk '{printf "fully charged", $1}'
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "charging"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pmset_battery_remaining_time() {
|
|
||||||
local status="$(pmset -g batt)"
|
|
||||||
if echo $status | grep 'no estimate' >/dev/null 2>&1; then
|
|
||||||
if $short; then
|
|
||||||
echo '~?:??'
|
|
||||||
else
|
|
||||||
echo '- Calculating estimate...'
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
local remaining_time="$(echo $status | grep -o '[0-9]\{1,2\}:[0-9]\{1,2\}')"
|
|
||||||
if battery_discharging; then
|
|
||||||
if $short; then
|
|
||||||
echo $remaining_time | awk '{printf "~%s", $1}'
|
|
||||||
else
|
|
||||||
echo $remaining_time | awk '{printf "- %s left", $1}'
|
|
||||||
fi
|
|
||||||
elif battery_charged; then
|
|
||||||
if $short; then
|
|
||||||
echo $remaining_time | awk '{printf "charged", $1}'
|
|
||||||
else
|
|
||||||
echo $remaining_time | awk '{printf "fully charged", $1}'
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if $short; then
|
|
||||||
echo $remaining_time | awk '{printf "~%s", $1}'
|
|
||||||
else
|
|
||||||
echo $remaining_time | awk '{printf "- %s till full", $1}'
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
upower_battery_remaining_time() {
|
|
||||||
battery=$(upower -e | grep -E 'battery|DisplayDevice'| tail -n1)
|
|
||||||
if battery_discharging; then
|
|
||||||
local remaining_time
|
|
||||||
remaining_time=$(upower -i "$battery" | grep -E '(remain|time to empty)')
|
|
||||||
if $short; then
|
|
||||||
echo "$remaining_time" | awk '{printf "%s %s", $(NF-1), $(NF)}'
|
|
||||||
else
|
|
||||||
echo "$remaining_time" | awk '{printf "%s %s left", $(NF-1), $(NF)}'
|
|
||||||
fi
|
|
||||||
elif battery_charged; then
|
|
||||||
if $short; then
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
echo "charged"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
local remaining_time
|
|
||||||
remaining_time=$(upower -i "$battery" | grep -E 'time to full')
|
|
||||||
if $short; then
|
|
||||||
echo "$remaining_time" | awk '{printf "%s %s", $(NF-1), $(NF)}'
|
|
||||||
else
|
|
||||||
echo "$remaining_time" | awk '{printf "%s %s to full", $(NF-1), $(NF)}'
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
acpi_battery_remaining_time() {
|
|
||||||
regex="[0-9]+:[0-9]+"
|
|
||||||
if ! $short; then
|
|
||||||
regex="$regex:[0-9]+"
|
|
||||||
fi
|
|
||||||
acpi -b | grep -m 1 -Eo "$regex"
|
|
||||||
}
|
|
||||||
|
|
||||||
print_battery_remain() {
|
|
||||||
if is_wsl; then
|
|
||||||
echo "?" # currently unsupported on WSL
|
|
||||||
elif command_exists "pmset"; then
|
|
||||||
pmset_battery_remaining_time
|
|
||||||
elif command_exists "acpi"; then
|
|
||||||
acpi_battery_remaining_time
|
|
||||||
elif command_exists "upower"; then
|
|
||||||
upower_battery_remaining_time
|
|
||||||
elif command_exists "apm"; then
|
|
||||||
apm_battery_remaining_time
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
get_remain_settings
|
|
||||||
print_battery_remain
|
|
||||||
}
|
|
||||||
main
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
color_full_charge_default="#[bg=green]"
|
|
||||||
color_high_charge_default="#[bg=yellow]"
|
|
||||||
color_medium_charge_default="#[bg=colour208]" # orange
|
|
||||||
color_low_charge_default="#[bg=red]"
|
|
||||||
color_charging_default="#[bg=green]"
|
|
||||||
|
|
||||||
color_full_charge=""
|
|
||||||
color_high_charge=""
|
|
||||||
color_medium_charge=""
|
|
||||||
color_low_charge=""
|
|
||||||
color_charging=""
|
|
||||||
|
|
||||||
get_charge_color_settings() {
|
|
||||||
color_full_charge=$(get_tmux_option "@batt_color_full_charge" "$color_full_charge_default")
|
|
||||||
color_high_charge=$(get_tmux_option "@batt_color_high_charge" "$color_high_charge_default")
|
|
||||||
color_medium_charge=$(get_tmux_option "@batt_color_medium_charge" "$color_medium_charge_default")
|
|
||||||
color_low_charge=$(get_tmux_option "@batt_color_low_charge" "$color_low_charge_default")
|
|
||||||
color_charging=$(get_tmux_option "@batt_color_charging" "$color_charging_default")
|
|
||||||
}
|
|
||||||
|
|
||||||
print_battery_status_bg() {
|
|
||||||
# Call `battery_percentage.sh`.
|
|
||||||
percentage=$($CURRENT_DIR/battery_percentage.sh | sed -e 's/%//')
|
|
||||||
status=$(battery_status | awk '{print $1;}')
|
|
||||||
if [ $status == 'charging' ]; then
|
|
||||||
printf $color_charging
|
|
||||||
elif [ $percentage -eq 100 ]; then
|
|
||||||
printf $color_full_charge
|
|
||||||
elif [ $percentage -le 99 -a $percentage -ge 51 ];then
|
|
||||||
printf $color_high_charge
|
|
||||||
elif [ $percentage -le 50 -a $percentage -ge 16 ];then
|
|
||||||
printf $color_medium_charge
|
|
||||||
elif [ "$percentage" == "" ];then
|
|
||||||
printf $color_full_charge_default # assume it's a desktop
|
|
||||||
else
|
|
||||||
printf $color_low_charge
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
get_charge_color_settings
|
|
||||||
print_battery_status_bg
|
|
||||||
}
|
|
||||||
main
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
|
||||||
|
|
||||||
color_full_charge_default="#[fg=green]"
|
|
||||||
color_high_charge_default="#[fg=yellow]"
|
|
||||||
color_medium_charge_default="#[fg=colour208]" # orange
|
|
||||||
color_low_charge_default="#[fg=red]"
|
|
||||||
color_charging_default="#[fg=green]"
|
|
||||||
|
|
||||||
color_full_charge=""
|
|
||||||
color_high_charge=""
|
|
||||||
color_medium_charge=""
|
|
||||||
color_low_charge=""
|
|
||||||
color_charging=""
|
|
||||||
|
|
||||||
get_charge_color_settings() {
|
|
||||||
color_full_charge=$(get_tmux_option "@batt_color_full_charge" "$color_full_charge_default")
|
|
||||||
color_high_charge=$(get_tmux_option "@batt_color_high_charge" "$color_high_charge_default")
|
|
||||||
color_medium_charge=$(get_tmux_option "@batt_color_medium_charge" "$color_medium_charge_default")
|
|
||||||
color_low_charge=$(get_tmux_option "@batt_color_low_charge" "$color_low_charge_default")
|
|
||||||
color_charging=$(get_tmux_option "@batt_color_charging" "$color_charging_default")
|
|
||||||
}
|
|
||||||
|
|
||||||
print_battery_status_fg() {
|
|
||||||
# Call `battery_percentage.sh`.
|
|
||||||
percentage=$($CURRENT_DIR/battery_percentage.sh | sed -e 's/%//')
|
|
||||||
status=$(battery_status | awk '{print $1;}')
|
|
||||||
if [ $status == 'charging' ]; then
|
|
||||||
printf $color_charging
|
|
||||||
elif [ $percentage -eq 100 ]; then
|
|
||||||
printf $color_full_charge
|
|
||||||
elif [ $percentage -le 99 -a $percentage -ge 51 ];then
|
|
||||||
printf $color_high_charge
|
|
||||||
elif [ $percentage -le 50 -a $percentage -ge 16 ];then
|
|
||||||
printf $color_medium_charge
|
|
||||||
elif [ "$percentage" == "" ];then
|
|
||||||
printf $color_full_charge_default # assume it's a desktop
|
|
||||||
else
|
|
||||||
printf $color_low_charge
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
get_charge_color_settings
|
|
||||||
print_battery_status_fg
|
|
||||||
}
|
|
||||||
main
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
get_tmux_option() {
|
|
||||||
local option="$1"
|
|
||||||
local default_value="$2"
|
|
||||||
local option_value="$(tmux show-option -gqv "$option")"
|
|
||||||
if [ -z "$option_value" ]; then
|
|
||||||
echo "$default_value"
|
|
||||||
else
|
|
||||||
echo "$option_value"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
is_osx() {
|
|
||||||
[ $(uname) == "Darwin" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
is_chrome() {
|
|
||||||
chrome="/sys/class/chromeos/cros_ec"
|
|
||||||
if [ -d "$chrome" ]; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
is_wsl() {
|
|
||||||
version=$(</proc/version)
|
|
||||||
if [[ "$version" == *"Microsoft"* || "$version" == *"microsoft"* ]]; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
command_exists() {
|
|
||||||
local command="$1"
|
|
||||||
type "$command" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
battery_status() {
|
|
||||||
if is_wsl; then
|
|
||||||
local battery
|
|
||||||
battery=$(find /sys/class/power_supply/*/status | tail -n1)
|
|
||||||
awk '{print tolower($0);}' "$battery"
|
|
||||||
elif command_exists "pmset"; then
|
|
||||||
pmset -g batt | awk -F '; *' 'NR==2 { print $2 }'
|
|
||||||
elif command_exists "acpi"; then
|
|
||||||
acpi -b | awk '{gsub(/,/, ""); print tolower($3); exit}'
|
|
||||||
elif command_exists "upower"; then
|
|
||||||
local battery
|
|
||||||
battery=$(upower -e | grep -E 'battery|DisplayDevice'| tail -n1)
|
|
||||||
upower -i $battery | awk '/state/ {print $2}'
|
|
||||||
elif command_exists "termux-battery-status"; then
|
|
||||||
termux-battery-status | jq -r '.status' | awk '{printf("%s%", tolower($1))}'
|
|
||||||
elif command_exists "apm"; then
|
|
||||||
local battery
|
|
||||||
battery=$(apm -a)
|
|
||||||
if [ $battery -eq 0 ]; then
|
|
||||||
echo "discharging"
|
|
||||||
elif [ $battery -eq 1 ]; then
|
|
||||||
echo "charging"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
@@ -54,28 +54,21 @@ set -ag terminal-overrides ",$TERM:Tc"
|
|||||||
# Remove confirm prompt when closing pane
|
# Remove confirm prompt when closing pane
|
||||||
bind-key x kill-pane
|
bind-key x kill-pane
|
||||||
|
|
||||||
# Place statusbar at the top
|
# Styling
|
||||||
set-option -g status-position top
|
set-option -g status-position top
|
||||||
|
set -g mode-style "fg=black,bg=orange"
|
||||||
|
set-option -g pane-border-style fg=colour236
|
||||||
|
set-option -g pane-active-border-style fg=orange
|
||||||
|
set-window-option -g window-status-current-style fg=orange,bg=default,bright
|
||||||
|
set-window-option -g window-status-style fg=colour244,bg=default
|
||||||
|
set-window-option -g clock-mode-colour orange
|
||||||
|
set-option -g status-style "bg=default,fg=white"
|
||||||
|
set-option -g status-left ""
|
||||||
|
set-option -g status-right '[Session: #S] [CPU: #{cpu_fg_color}#{cpu_percentage}#[default]] [RAM: #{ram_fg_color}#{ram_percentage}#[default]] %d#[dim]/#[default]%m#[dim]/#[default]%Y %I:%M#[dim]%P#[default]'
|
||||||
|
set -g status-interval 1
|
||||||
|
set -g status-right-length 60
|
||||||
|
|
||||||
# Load TMUX Plugins
|
# Load TMUX Plugins
|
||||||
set -g @catppuccin_window_left_separator ""
|
set -g @cpu_high_fg_color "#[fg=#FF0000]"
|
||||||
set -g @catppuccin_window_right_separator " "
|
set -g @ram_high_fg_color "#[fg=#FF0000]"
|
||||||
set -g @catppuccin_window_middle_separator " █"
|
|
||||||
set -g @catppuccin_window_number_position "right"
|
|
||||||
|
|
||||||
set -g @catppuccin_window_default_fill "number"
|
|
||||||
set -g @catppuccin_window_default_text "#W"
|
|
||||||
|
|
||||||
set -g @catppuccin_window_current_fill "number"
|
|
||||||
set -g @catppuccin_window_current_text "#W"
|
|
||||||
|
|
||||||
set -g @catppuccin_status_modules_right "directory user host session cpu battery"
|
|
||||||
set -g @catppuccin_status_left_separator " "
|
|
||||||
set -g @catppuccin_status_right_separator ""
|
|
||||||
set -g @catppuccin_status_fill "icon"
|
|
||||||
set -g @catppuccin_status_connect_separator "no"
|
|
||||||
|
|
||||||
set -g @catppuccin_directory_text "#{pane_current_path}"
|
|
||||||
run '~/.config/tmux/plugins/theme/theme.tmux'
|
|
||||||
run-shell '~/.config/tmux/plugins/tmux-cpu/cpu.tmux'
|
run-shell '~/.config/tmux/plugins/tmux-cpu/cpu.tmux'
|
||||||
run-shell '~/.config/tmux/plugins/tmux-battery/battery.tmux'
|
|
||||||
|
|||||||
Reference in New Issue
Block a user