feat: add customizable statusbar (#31)
* feat: define dark and light color palettes * feat: add customization of status-right & status-left sections * feat: rename to gruvbox_dark256 and implement alpha option * fix: transparency for tabs in left status bar * fix: shellcheck errors * fix: files according to shfmt * feat: remove unnecessary modeline * feat: save palettes as 256 color * feat: update information about dark256 & light256 themes * chore: add changelog entry
This commit is contained in:
parent
f01574b318
commit
4f8b69ab8b
10 changed files with 487 additions and 48 deletions
78
src/tmux_utils.sh
Normal file
78
src/tmux_utils.sh
Normal file
|
@ -0,0 +1,78 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get desired option from tmux or default
|
||||
tmux_get_option_or_default() {
|
||||
local _option_name _default_value
|
||||
_option_name="$1"
|
||||
_default_value="$2"
|
||||
|
||||
local _current_option_value
|
||||
_current_option_value=$(tmux show-option -gqv "$_option_name")
|
||||
if [[ -n "$_current_option_value" ]]; then
|
||||
echo "$_current_option_value"
|
||||
else
|
||||
echo "$_default_value"
|
||||
fi
|
||||
}
|
||||
|
||||
# get desired tmux option or use given default value
|
||||
tmux_get_option() {
|
||||
local _option_name _default_value
|
||||
_option_name="$1"
|
||||
_default_value="$2"
|
||||
|
||||
local _current_option_value
|
||||
_current_option_value=$(tmux show-option -gqv "$_option_name")
|
||||
if [[ -n "$_current_option_value" ]]; then
|
||||
echo "$_current_option_value"
|
||||
else
|
||||
echo "$_default_value"
|
||||
fi
|
||||
}
|
||||
|
||||
# get desired window-option from tmux or default
|
||||
tmux_get_window_option() {
|
||||
local _option_name _default_value
|
||||
_option_name="$1"
|
||||
_default_value="$2"
|
||||
|
||||
local _current_option_value
|
||||
_current_option_value=$(tmux show-window-option -gqv "$_option_name")
|
||||
if [[ -n "$_current_option_value" ]]; then
|
||||
echo "$_current_option_value"
|
||||
else
|
||||
echo "$_default_value"
|
||||
fi
|
||||
}
|
||||
|
||||
# append preconfigured tmux set-option to global array
|
||||
tmux_append_seto() {
|
||||
local _option _value _result
|
||||
_option="$1"
|
||||
_value="$2"
|
||||
TMUX_CMDS+=("set-option" "-gq" "${_option}" "${_value}" ";")
|
||||
}
|
||||
|
||||
# append preconfigured tmux set-window-option to global array
|
||||
tmux_append_setwo() {
|
||||
local _option _value _result
|
||||
_option="$1"
|
||||
_value="$2"
|
||||
TMUX_CMDS+=("set-window-option" "-gq" "${_option}" "${_value}" ";")
|
||||
}
|
||||
|
||||
# imediately execute tmux option
|
||||
tmux_set_option_now() {
|
||||
local _option_name _value
|
||||
_option_name="$1"
|
||||
_value="$2"
|
||||
tmux set-option -gq "$_option_name" "$_value"
|
||||
}
|
||||
|
||||
# imediately execute tmux option
|
||||
tmux_set_window_option_now() {
|
||||
local _option_name _value
|
||||
_option_name="$1"
|
||||
_value="$2"
|
||||
tmux set-window-option -gq "$_option_name" "$_value"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue