tmux
This commit is contained in:
@ -95,11 +95,7 @@ bind-key C-a set-option -g prefix C-a
|
|||||||
# No delay for escape key press
|
# No delay for escape key press
|
||||||
set -sg escape-time 0
|
set -sg escape-time 0
|
||||||
|
|
||||||
setw -g window-status-format "#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #W "
|
|
||||||
setw -g window-status-current-format "#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #W "
|
|
||||||
|
|
||||||
# List of plugins
|
# List of plugins
|
||||||
set -g @plugin 'catppuccin/tmux'
|
|
||||||
set -g @plugin 'tmux-plugins/tpm'
|
set -g @plugin 'tmux-plugins/tpm'
|
||||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||||
set -g @plugin 'tmux-plugins/tmux-yank'
|
set -g @plugin 'tmux-plugins/tmux-yank'
|
||||||
@ -107,9 +103,10 @@ set -g @plugin 'christoomey/vim-tmux-navigator'
|
|||||||
set -g @plugin 'tmux-plugins/tmux-cpu'
|
set -g @plugin 'tmux-plugins/tmux-cpu'
|
||||||
set -g @plugin 'tmux-plugins/tmux-battery'
|
set -g @plugin 'tmux-plugins/tmux-battery'
|
||||||
set -g @plugin 'tmux-plugins/tmux-cowboy' # Kill process in pane w/ prefix+*
|
set -g @plugin 'tmux-plugins/tmux-cowboy' # Kill process in pane w/ prefix+*
|
||||||
|
set -g @plugin 'catppuccin/tmux'
|
||||||
#set -g @plugin 'odedlaz/tmux-onedark-theme'
|
#set -g @plugin 'odedlaz/tmux-onedark-theme'
|
||||||
|
|
||||||
# set -g @catppuccin_flavour 'latte' # or frappe, macchiato, mocha
|
set -g @catppuccin_flavour 'macchiato' # or frappe, macchiato, mocha
|
||||||
|
|
||||||
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
||||||
run '~/.tmux/plugins/tpm/tpm'
|
run '~/.tmux/plugins/tpm/tpm'
|
||||||
|
Submodule tmux/.tmux/plugins/tmux deleted from d9e5c6d1e3
12
tmux/.tmux/plugins/tmux-cpu/.github/workflows/check.yml
vendored
Normal file
12
tmux/.tmux/plugins/tmux-cpu/.github/workflows/check.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
name: Check
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: luizm/action-sh-checker@master
|
||||||
|
env:
|
||||||
|
SHELLCHECK_OPTS: -x
|
@ -72,9 +72,12 @@ do_interpolation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_tmux_option() {
|
update_tmux_option() {
|
||||||
local option=$1
|
local option
|
||||||
local option_value=$(get_tmux_option "$option")
|
local option_value
|
||||||
local new_option_value=$(do_interpolation "$option_value")
|
local new_option_value
|
||||||
|
option=$1
|
||||||
|
option_value=$(get_tmux_option "$option")
|
||||||
|
new_option_value=$(do_interpolation "$option_value")
|
||||||
set_tmux_option "$option" "$new_option_value"
|
set_tmux_option "$option" "$new_option_value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
cpu_low_bg_color=""
|
cpu_low_bg_color=""
|
||||||
@ -19,13 +20,15 @@ get_bg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_bg_color() {
|
print_bg_color() {
|
||||||
local cpu_percentage=$($CURRENT_DIR/cpu_percentage.sh | sed -e 's/%//')
|
local cpu_percentage
|
||||||
local load_status=$(load_status $cpu_percentage)
|
local load_status
|
||||||
if [ $load_status == "low" ]; then
|
cpu_percentage=$("$CURRENT_DIR"/cpu_percentage.sh | sed -e 's/%//')
|
||||||
|
load_status=$(load_status "$cpu_percentage" "cpu")
|
||||||
|
if [ "$load_status" == "low" ]; then
|
||||||
echo "$cpu_low_bg_color"
|
echo "$cpu_low_bg_color"
|
||||||
elif [ $load_status == "medium" ]; then
|
elif [ "$load_status" == "medium" ]; then
|
||||||
echo "$cpu_medium_bg_color"
|
echo "$cpu_medium_bg_color"
|
||||||
elif [ $load_status == "high" ]; then
|
elif [ "$load_status" == "high" ]; then
|
||||||
echo "$cpu_high_bg_color"
|
echo "$cpu_high_bg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -34,4 +37,4 @@ main() {
|
|||||||
get_bg_color_settings
|
get_bg_color_settings
|
||||||
print_bg_color
|
print_bg_color
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
cpu_low_fg_color=""
|
cpu_low_fg_color=""
|
||||||
@ -19,13 +20,15 @@ get_fg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_fg_color() {
|
print_fg_color() {
|
||||||
local cpu_percentage=$($CURRENT_DIR/cpu_percentage.sh | sed -e 's/%//')
|
local cpu_percentage
|
||||||
local load_status=$(load_status $cpu_percentage)
|
local load_status
|
||||||
if [ $load_status == "low" ]; then
|
cpu_percentage=$("$CURRENT_DIR"/cpu_percentage.sh | sed -e 's/%//')
|
||||||
|
load_status=$(load_status "$cpu_percentage" "cpu")
|
||||||
|
if [ "$load_status" == "low" ]; then
|
||||||
echo "$cpu_low_fg_color"
|
echo "$cpu_low_fg_color"
|
||||||
elif [ $load_status == "medium" ]; then
|
elif [ "$load_status" == "medium" ]; then
|
||||||
echo "$cpu_medium_fg_color"
|
echo "$cpu_medium_fg_color"
|
||||||
elif [ $load_status == "high" ]; then
|
elif [ "$load_status" == "high" ]; then
|
||||||
echo "$cpu_high_fg_color"
|
echo "$cpu_high_fg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -34,4 +37,4 @@ main() {
|
|||||||
get_fg_color_settings
|
get_fg_color_settings
|
||||||
print_fg_color
|
print_fg_color
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
# script global variables
|
# script global variables
|
||||||
@ -21,13 +22,15 @@ get_icon_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_icon() {
|
print_icon() {
|
||||||
local cpu_percentage=$($CURRENT_DIR/cpu_percentage.sh | sed -e 's/%//')
|
local cpu_percentage
|
||||||
local load_status=$(load_status $cpu_percentage)
|
local load_status
|
||||||
if [ $load_status == "low" ]; then
|
cpu_percentage=$("$CURRENT_DIR"/cpu_percentage.sh | sed -e 's/%//')
|
||||||
|
load_status=$(load_status "$cpu_percentage" "cpu")
|
||||||
|
if [ "$load_status" == "low" ]; then
|
||||||
echo "$cpu_low_icon"
|
echo "$cpu_low_icon"
|
||||||
elif [ $load_status == "medium" ]; then
|
elif [ "$load_status" == "medium" ]; then
|
||||||
echo "$cpu_medium_icon"
|
echo "$cpu_medium_icon"
|
||||||
elif [ $load_status == "high" ]; then
|
elif [ "$load_status" == "high" ]; then
|
||||||
echo "$cpu_high_icon"
|
echo "$cpu_high_icon"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -36,4 +39,4 @@ main() {
|
|||||||
get_icon_settings
|
get_icon_settings
|
||||||
print_icon "$1"
|
print_icon "$1"
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
cpu_percentage_format="%3.1f%%"
|
cpu_percentage_format="%3.1f%%"
|
||||||
@ -25,9 +26,10 @@ print_cpu_percentage() {
|
|||||||
else
|
else
|
||||||
if is_cygwin; then
|
if is_cygwin; then
|
||||||
usage="$(cached_eval WMIC cpu get LoadPercentage | grep -Eo '^[0-9]+')"
|
usage="$(cached_eval WMIC cpu get LoadPercentage | grep -Eo '^[0-9]+')"
|
||||||
|
# shellcheck disable=SC2059
|
||||||
printf "$cpu_percentage_format" "$usage"
|
printf "$cpu_percentage_format" "$usage"
|
||||||
else
|
else
|
||||||
load=`cached_eval ps -aux | awk '{print $3}' | tail -n+2 | awk '{s+=$1} END {print s}'`
|
load=$(cached_eval ps -aux | awk '{print $3}' | tail -n+2 | awk '{s+=$1} END {print s}')
|
||||||
cpus=$(cpus_number)
|
cpus=$(cpus_number)
|
||||||
echo "$load $cpus" | awk -v format="$cpu_percentage_format" '{printf format, $1/$2}'
|
echo "$load $cpus" | awk -v format="$cpu_percentage_format" '{printf format, $1/$2}'
|
||||||
fi
|
fi
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
cpu_temp_format="%2.0f"
|
cpu_temp_format="%2.0f"
|
||||||
@ -11,7 +12,13 @@ print_cpu_temp() {
|
|||||||
cpu_temp_format=$(get_tmux_option "@cpu_temp_format" "$cpu_temp_format")
|
cpu_temp_format=$(get_tmux_option "@cpu_temp_format" "$cpu_temp_format")
|
||||||
cpu_temp_unit=$(get_tmux_option "@cpu_temp_unit" "$cpu_temp_unit")
|
cpu_temp_unit=$(get_tmux_option "@cpu_temp_unit" "$cpu_temp_unit")
|
||||||
if command_exists "sensors"; then
|
if command_exists "sensors"; then
|
||||||
([ "$cpu_temp_unit" == F ] && sensors -f || sensors) | sed -e 's/^Tccd/Core /' | awk -v format="$cpu_temp_format$cpu_temp_unit" '/^Core [0-9]+/ {gsub("[^0-9.]", "", $3); sum+=$3; n+=1} END {printf(format, sum/n)}'
|
local val
|
||||||
|
if [[ "$cpu_temp_unit" == F ]]; then
|
||||||
|
val="$(sensors -f)"
|
||||||
|
else
|
||||||
|
val="$(sensors)"
|
||||||
|
fi
|
||||||
|
echo "$val" | sed -e 's/^Tccd/Core /' | awk -v format="$cpu_temp_format$cpu_temp_unit" '/^Core [0-9]+/ {gsub("[^0-9.]", "", $3); sum+=$3; n+=1} END {printf(format, sum/n)}'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
cpu_temp_low_bg_color=""
|
cpu_temp_low_bg_color=""
|
||||||
@ -19,13 +20,15 @@ get_bg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_bg_color() {
|
print_bg_color() {
|
||||||
local cpu_temp=$($CURRENT_DIR/cpu_temp.sh | sed -e 's/[^0-9.]//')
|
local cpu_temp
|
||||||
local cpu_temp_status=$(temp_status $cpu_temp)
|
local cpu_temp_status
|
||||||
if [ $cpu_temp_status == "low" ]; then
|
cpu_temp=$("$CURRENT_DIR"/cpu_temp.sh | sed -e 's/[^0-9.]//')
|
||||||
|
cpu_temp_status=$(temp_status "$cpu_temp")
|
||||||
|
if [ "$cpu_temp_status" == "low" ]; then
|
||||||
echo "$cpu_temp_low_bg_color"
|
echo "$cpu_temp_low_bg_color"
|
||||||
elif [ $cpu_temp_status == "medium" ]; then
|
elif [ "$cpu_temp_status" == "medium" ]; then
|
||||||
echo "$cpu_temp_medium_bg_color"
|
echo "$cpu_temp_medium_bg_color"
|
||||||
elif [ $cpu_temp_status == "high" ]; then
|
elif [ "$cpu_temp_status" == "high" ]; then
|
||||||
echo "$cpu_temp_high_bg_color"
|
echo "$cpu_temp_high_bg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
cpu_temp_low_fg_color=""
|
cpu_temp_low_fg_color=""
|
||||||
@ -19,13 +20,15 @@ get_fg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_fg_color() {
|
print_fg_color() {
|
||||||
local cpu_temp=$($CURRENT_DIR/cpu_temp.sh | sed -e 's/[^0-9.]//')
|
local cpu_temp
|
||||||
local cpu_temp_status=$(temp_status $cpu_temp)
|
local cpu_temp_status
|
||||||
if [ $cpu_temp_status == "low" ]; then
|
cpu_temp=$("$CURRENT_DIR"/cpu_temp.sh | sed -e 's/[^0-9.]//')
|
||||||
|
cpu_temp_status=$(temp_status "$cpu_temp")
|
||||||
|
if [ "$cpu_temp_status" == "low" ]; then
|
||||||
echo "$cpu_temp_low_fg_color"
|
echo "$cpu_temp_low_fg_color"
|
||||||
elif [ $cpu_temp_status == "medium" ]; then
|
elif [ "$cpu_temp_status" == "medium" ]; then
|
||||||
echo "$cpu_temp_medium_fg_color"
|
echo "$cpu_temp_medium_fg_color"
|
||||||
elif [ $cpu_temp_status == "high" ]; then
|
elif [ "$cpu_temp_status" == "high" ]; then
|
||||||
echo "$cpu_temp_high_fg_color"
|
echo "$cpu_temp_high_fg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
# script global variables
|
# script global variables
|
||||||
@ -21,13 +22,15 @@ get_icon_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_icon() {
|
print_icon() {
|
||||||
local cpu_temp=$($CURRENT_DIR/cpu_temp.sh | sed -e 's/[^0-9.]//')
|
local cpu_temp
|
||||||
local cpu_temp_status=$(temp_status $cpu_temp)
|
local cpu_temp_status
|
||||||
if [ $cpu_temp_status == "low" ]; then
|
cpu_temp=$("$CURRENT_DIR"/cpu_temp.sh | sed -e 's/[^0-9.]//')
|
||||||
|
cpu_temp_status=$(temp_status "$cpu_temp")
|
||||||
|
if [ "$cpu_temp_status" == "low" ]; then
|
||||||
echo "$cpu_temp_low_icon"
|
echo "$cpu_temp_low_icon"
|
||||||
elif [ $cpu_temp_status == "medium" ]; then
|
elif [ "$cpu_temp_status" == "medium" ]; then
|
||||||
echo "$cpu_temp_medium_icon"
|
echo "$cpu_temp_medium_icon"
|
||||||
elif [ $cpu_temp_status == "high" ]; then
|
elif [ "$cpu_temp_status" == "high" ]; then
|
||||||
echo "$cpu_temp_high_icon"
|
echo "$cpu_temp_high_icon"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -36,4 +39,4 @@ main() {
|
|||||||
get_icon_settings
|
get_icon_settings
|
||||||
print_icon "$1"
|
print_icon "$1"
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
gpu_low_bg_color=""
|
gpu_low_bg_color=""
|
||||||
@ -19,13 +20,15 @@ get_bg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_bg_color() {
|
print_bg_color() {
|
||||||
local gpu_percentage=$($CURRENT_DIR/gpu_percentage.sh | sed -e 's/%//')
|
local gpu_percentage
|
||||||
local gpu_load_status=$(load_status $gpu_percentage)
|
local gpu_load_status
|
||||||
if [ $gpu_load_status == "low" ]; then
|
gpu_percentage=$("$CURRENT_DIR"/gpu_percentage.sh | sed -e 's/%//')
|
||||||
|
gpu_load_status=$(load_status "$gpu_percentage" "gpu")
|
||||||
|
if [ "$gpu_load_status" == "low" ]; then
|
||||||
echo "$gpu_low_bg_color"
|
echo "$gpu_low_bg_color"
|
||||||
elif [ $gpu_load_status == "medium" ]; then
|
elif [ "$gpu_load_status" == "medium" ]; then
|
||||||
echo "$gpu_medium_bg_color"
|
echo "$gpu_medium_bg_color"
|
||||||
elif [ $gpu_load_status == "high" ]; then
|
elif [ "$gpu_load_status" == "high" ]; then
|
||||||
echo "$gpu_high_bg_color"
|
echo "$gpu_high_bg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -34,4 +37,4 @@ main() {
|
|||||||
get_bg_color_settings
|
get_bg_color_settings
|
||||||
print_bg_color
|
print_bg_color
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
gpu_low_fg_color=""
|
gpu_low_fg_color=""
|
||||||
@ -19,13 +20,15 @@ get_fg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_fg_color() {
|
print_fg_color() {
|
||||||
local gpu_percentage=$($CURRENT_DIR/gpu_percentage.sh | sed -e 's/%//')
|
local gpu_percentage
|
||||||
local gpu_load_status=$(load_status $gpu_percentage)
|
local gpu_load_status
|
||||||
if [ $gpu_load_status == "low" ]; then
|
gpu_percentage=$("$CURRENT_DIR"/gpu_percentage.sh | sed -e 's/%//')
|
||||||
|
gpu_load_status=$(load_status "$gpu_percentage" "gpu")
|
||||||
|
if [ "$gpu_load_status" == "low" ]; then
|
||||||
echo "$gpu_low_fg_color"
|
echo "$gpu_low_fg_color"
|
||||||
elif [ $gpu_load_status == "medium" ]; then
|
elif [ "$gpu_load_status" == "medium" ]; then
|
||||||
echo "$gpu_medium_fg_color"
|
echo "$gpu_medium_fg_color"
|
||||||
elif [ $gpu_load_status == "high" ]; then
|
elif [ "$gpu_load_status" == "high" ]; then
|
||||||
echo "$gpu_high_fg_color"
|
echo "$gpu_high_fg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -34,4 +37,4 @@ main() {
|
|||||||
get_fg_color_settings
|
get_fg_color_settings
|
||||||
print_fg_color
|
print_fg_color
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
# script global variables
|
# script global variables
|
||||||
@ -21,13 +22,15 @@ get_icon_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_icon() {
|
print_icon() {
|
||||||
local gpu_percentage=$($CURRENT_DIR/gpu_percentage.sh | sed -e 's/%//')
|
local gpu_percentage
|
||||||
local gpu_load_status=$(load_status $gpu_percentage)
|
local gpu_load_status
|
||||||
if [ $gpu_load_status == "low" ]; then
|
gpu_percentage=$("$CURRENT_DIR"/gpu_percentage.sh | sed -e 's/%//')
|
||||||
|
gpu_load_status=$(load_status "$gpu_percentage" "gpu")
|
||||||
|
if [ "$gpu_load_status" == "low" ]; then
|
||||||
echo "$gpu_low_icon"
|
echo "$gpu_low_icon"
|
||||||
elif [ $gpu_load_status == "medium" ]; then
|
elif [ "$gpu_load_status" == "medium" ]; then
|
||||||
echo "$gpu_medium_icon"
|
echo "$gpu_medium_icon"
|
||||||
elif [ $gpu_load_status == "high" ]; then
|
elif [ "$gpu_load_status" == "high" ]; then
|
||||||
echo "$gpu_high_icon"
|
echo "$gpu_high_icon"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -36,4 +39,4 @@ main() {
|
|||||||
get_icon_settings
|
get_icon_settings
|
||||||
print_icon "$1"
|
print_icon "$1"
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
gpu_percentage_format="%3.1f%%"
|
gpu_percentage_format="%3.1f%%"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
gpu_temp_format="%2.0f"
|
gpu_temp_format="%2.0f"
|
||||||
@ -20,7 +21,7 @@ print_gpu_temp() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
tempC=$(echo "$loads" | sed -nr 's/.*\s([0-9]+)C.*/\1/p' | awk '{sum+=$1; n+=1} END {printf "%5.3f", sum/n}')
|
tempC=$(echo "$loads" | sed -nr 's/.*\s([0-9]+)C.*/\1/p' | awk '{sum+=$1; n+=1} END {printf "%5.3f", sum/n}')
|
||||||
if [ $gpu_temp_unit == "C" ]; then
|
if [ "$gpu_temp_unit" == "C" ]; then
|
||||||
echo "$tempC" | awk -v format="${gpu_temp_format}C" '{sum+=$1} END {printf format, sum}'
|
echo "$tempC" | awk -v format="${gpu_temp_format}C" '{sum+=$1} END {printf format, sum}'
|
||||||
else
|
else
|
||||||
echo "$tempC" | awk -v format="${gpu_temp_format}F" '{sum+=$1} END {printf format, sum*9/5+32}'
|
echo "$tempC" | awk -v format="${gpu_temp_format}F" '{sum+=$1} END {printf format, sum*9/5+32}'
|
||||||
@ -30,4 +31,4 @@ print_gpu_temp() {
|
|||||||
main() {
|
main() {
|
||||||
print_gpu_temp
|
print_gpu_temp
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
gpu_temp_low_bg_color=""
|
gpu_temp_low_bg_color=""
|
||||||
@ -19,13 +20,15 @@ get_bg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_bg_color() {
|
print_bg_color() {
|
||||||
local gpu_temp=$($CURRENT_DIR/gpu_temp.sh | sed -e 's/[^0-9.]//')
|
local gpu_temp
|
||||||
local gpu_temp_status=$(temp_status $gpu_temp)
|
local gpu_temp_status
|
||||||
if [ $gpu_temp_status == "low" ]; then
|
gpu_temp=$("$CURRENT_DIR"/gpu_temp.sh | sed -e 's/[^0-9.]//')
|
||||||
|
gpu_temp_status=$(temp_status "$gpu_temp")
|
||||||
|
if [ "$gpu_temp_status" == "low" ]; then
|
||||||
echo "$gpu_temp_low_bg_color"
|
echo "$gpu_temp_low_bg_color"
|
||||||
elif [ $gpu_temp_status == "medium" ]; then
|
elif [ "$gpu_temp_status" == "medium" ]; then
|
||||||
echo "$gpu_temp_medium_bg_color"
|
echo "$gpu_temp_medium_bg_color"
|
||||||
elif [ $gpu_temp_status == "high" ]; then
|
elif [ "$gpu_temp_status" == "high" ]; then
|
||||||
echo "$gpu_temp_high_bg_color"
|
echo "$gpu_temp_high_bg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -34,4 +37,4 @@ main() {
|
|||||||
get_bg_color_settings
|
get_bg_color_settings
|
||||||
print_bg_color
|
print_bg_color
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
gpu_temp_low_fg_color=""
|
gpu_temp_low_fg_color=""
|
||||||
@ -19,13 +20,15 @@ get_fg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_fg_color() {
|
print_fg_color() {
|
||||||
local gpu_temp=$($CURRENT_DIR/gpu_temp.sh | sed -e 's/[^0-9.]//')
|
local gpu_temp
|
||||||
local gpu_temp_status=$(temp_status $gpu_temp)
|
local gpu_temp_status
|
||||||
if [ $gpu_temp_status == "low" ]; then
|
gpu_temp=$("$CURRENT_DIR"/gpu_temp.sh | sed -e 's/[^0-9.]//')
|
||||||
|
gpu_temp_status=$(temp_status "$gpu_temp")
|
||||||
|
if [ "$gpu_temp_status" == "low" ]; then
|
||||||
echo "$gpu_temp_low_fg_color"
|
echo "$gpu_temp_low_fg_color"
|
||||||
elif [ $gpu_temp_status == "medium" ]; then
|
elif [ "$gpu_temp_status" == "medium" ]; then
|
||||||
echo "$gpu_temp_medium_fg_color"
|
echo "$gpu_temp_medium_fg_color"
|
||||||
elif [ $gpu_temp_status == "high" ]; then
|
elif [ "$gpu_temp_status" == "high" ]; then
|
||||||
echo "$gpu_temp_high_fg_color"
|
echo "$gpu_temp_high_fg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -34,4 +37,4 @@ main() {
|
|||||||
get_fg_color_settings
|
get_fg_color_settings
|
||||||
print_fg_color
|
print_fg_color
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
# script global variables
|
# script global variables
|
||||||
@ -21,13 +22,15 @@ get_icon_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_icon() {
|
print_icon() {
|
||||||
local gpu_temp=$($CURRENT_DIR/gpu_temp.sh | sed -e 's/[^0-9.]//')
|
local gpu_temp
|
||||||
local gpu_temp_status=$(temp_status $gpu_temp)
|
local gpu_temp_status
|
||||||
if [ $gpu_temp_status == "low" ]; then
|
gpu_temp=$("$CURRENT_DIR"/gpu_temp.sh | sed -e 's/[^0-9.]//')
|
||||||
|
gpu_temp_status=$(temp_status "$gpu_temp")
|
||||||
|
if [ "$gpu_temp_status" == "low" ]; then
|
||||||
echo "$gpu_temp_low_icon"
|
echo "$gpu_temp_low_icon"
|
||||||
elif [ $gpu_temp_status == "medium" ]; then
|
elif [ "$gpu_temp_status" == "medium" ]; then
|
||||||
echo "$gpu_temp_medium_icon"
|
echo "$gpu_temp_medium_icon"
|
||||||
elif [ $gpu_temp_status == "high" ]; then
|
elif [ "$gpu_temp_status" == "high" ]; then
|
||||||
echo "$gpu_temp_high_icon"
|
echo "$gpu_temp_high_icon"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -36,4 +39,4 @@ main() {
|
|||||||
get_icon_settings
|
get_icon_settings
|
||||||
print_icon "$1"
|
print_icon "$1"
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
gram_low_bg_color=""
|
gram_low_bg_color=""
|
||||||
@ -19,13 +20,15 @@ get_bg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_bg_color() {
|
print_bg_color() {
|
||||||
local gram_percentage=$($CURRENT_DIR/gram_percentage.sh | sed -e 's/%//')
|
local gram_percentage
|
||||||
local gram_load_status=$(load_status $gram_percentage)
|
local gram_load_status
|
||||||
if [ $gram_load_status == "low" ]; then
|
gram_percentage=$("$CURRENT_DIR"/gram_percentage.sh | sed -e 's/%//')
|
||||||
|
gram_load_status=$(load_status "$gram_percentage" "gram")
|
||||||
|
if [ "$gram_load_status" == "low" ]; then
|
||||||
echo "$gram_low_bg_color"
|
echo "$gram_low_bg_color"
|
||||||
elif [ $gram_load_status == "medium" ]; then
|
elif [ "$gram_load_status" == "medium" ]; then
|
||||||
echo "$gram_medium_bg_color"
|
echo "$gram_medium_bg_color"
|
||||||
elif [ $gram_load_status == "high" ]; then
|
elif [ "$gram_load_status" == "high" ]; then
|
||||||
echo "$gram_high_bg_color"
|
echo "$gram_high_bg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -34,4 +37,4 @@ main() {
|
|||||||
get_bg_color_settings
|
get_bg_color_settings
|
||||||
print_bg_color
|
print_bg_color
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
gram_low_fg_color=""
|
gram_low_fg_color=""
|
||||||
@ -19,13 +20,15 @@ get_fg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_fg_color() {
|
print_fg_color() {
|
||||||
local gram_percentage=$($CURRENT_DIR/gram_percentage.sh | sed -e 's/%//')
|
local gram_percentage
|
||||||
local gram_load_status=$(load_status $gram_percentage)
|
local gram_load_status
|
||||||
if [ $gram_load_status == "low" ]; then
|
gram_percentage=$("$CURRENT_DIR"/gram_percentage.sh | sed -e 's/%//')
|
||||||
|
gram_load_status=$(load_status "$gram_percentage" "gram")
|
||||||
|
if [ "$gram_load_status" == "low" ]; then
|
||||||
echo "$gram_low_fg_color"
|
echo "$gram_low_fg_color"
|
||||||
elif [ $gram_load_status == "medium" ]; then
|
elif [ "$gram_load_status" == "medium" ]; then
|
||||||
echo "$gram_medium_fg_color"
|
echo "$gram_medium_fg_color"
|
||||||
elif [ $gram_load_status == "high" ]; then
|
elif [ "$gram_load_status" == "high" ]; then
|
||||||
echo "$gram_high_fg_color"
|
echo "$gram_high_fg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -34,4 +37,4 @@ main() {
|
|||||||
get_fg_color_settings
|
get_fg_color_settings
|
||||||
print_fg_color
|
print_fg_color
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
# script global variables
|
# script global variables
|
||||||
@ -21,13 +22,15 @@ get_icon_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_icon() {
|
print_icon() {
|
||||||
local gram_percentage=$($CURRENT_DIR/gram_percentage.sh | sed -e 's/%//')
|
local gram_percentage
|
||||||
local gram_load_status=$(load_status $gram_percentage)
|
local gram_load_status
|
||||||
if [ $gram_load_status == "low" ]; then
|
gram_percentage=$("$CURRENT_DIR"/gram_percentage.sh | sed -e 's/%//')
|
||||||
|
gram_load_status=$(load_status "$gram_percentage" "gram")
|
||||||
|
if [ "$gram_load_status" == "low" ]; then
|
||||||
echo "$gram_low_icon"
|
echo "$gram_low_icon"
|
||||||
elif [ $gram_load_status == "medium" ]; then
|
elif [ "$gram_load_status" == "medium" ]; then
|
||||||
echo "$gram_medium_icon"
|
echo "$gram_medium_icon"
|
||||||
elif [ $gram_load_status == "high" ]; then
|
elif [ "$gram_load_status" == "high" ]; then
|
||||||
echo "$gram_high_icon"
|
echo "$gram_high_icon"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -36,4 +39,4 @@ main() {
|
|||||||
get_icon_settings
|
get_icon_settings
|
||||||
print_icon "$1"
|
print_icon "$1"
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
gram_percentage_format="%3.1f%%"
|
gram_percentage_format="%3.1f%%"
|
||||||
@ -17,10 +18,10 @@ print_gram_percentage() {
|
|||||||
echo "No GPU"
|
echo "No GPU"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo "$loads" | awk -v format="$gram_percentage_format" '{used+=$1; tot+=$2} END {printf format, 100*$1/$2}'
|
echo "$loads" | awk -v format="$gram_percentage_format" '{used+=$1; tot+=$2} END {printf format, 100*used/tot}'
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
print_gram_percentage
|
print_gram_percentage
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
export LANG=C
|
export LANG=C
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
get_tmux_option() {
|
get_tmux_option() {
|
||||||
local option="$1"
|
local option
|
||||||
local default_value="$2"
|
local default_value
|
||||||
local option_value="$(tmux show-option -qv "$option")"
|
local option_value
|
||||||
|
option="$1"
|
||||||
|
default_value="$2"
|
||||||
|
option_value="$(tmux show-option -qv "$option")"
|
||||||
if [ -z "$option_value" ]; then
|
if [ -z "$option_value" ]; then
|
||||||
option_value="$(tmux show-option -gqv "$option")"
|
option_value="$(tmux show-option -gqv "$option")"
|
||||||
fi
|
fi
|
||||||
@ -16,19 +21,19 @@ get_tmux_option() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_osx() {
|
is_osx() {
|
||||||
[ $(uname) == "Darwin" ]
|
[ "$(uname)" == "Darwin" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
is_freebsd() {
|
is_freebsd() {
|
||||||
[ $(uname) == "FreeBSD" ]
|
[ "$(uname)" == "FreeBSD" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
is_openbsd() {
|
is_openbsd() {
|
||||||
[ $(uname) == "OpenBSD" ]
|
[ "$(uname)" == "OpenBSD" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
is_linux() {
|
is_linux() {
|
||||||
[ $(uname) == "Linux" ]
|
[ "$(uname)" == "Linux" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
is_cygwin() {
|
is_cygwin() {
|
||||||
@ -42,16 +47,17 @@ is_linux_iostat() {
|
|||||||
|
|
||||||
# is second float bigger or equal?
|
# is second float bigger or equal?
|
||||||
fcomp() {
|
fcomp() {
|
||||||
awk -v n1=$1 -v n2=$2 'BEGIN {if (n1<=n2) exit 0; exit 1}'
|
awk -v n1="$1" -v n2="$2" 'BEGIN {if (n1<=n2) exit 0; exit 1}'
|
||||||
}
|
}
|
||||||
|
|
||||||
load_status() {
|
load_status() {
|
||||||
local percentage=$1
|
local percentage=$1
|
||||||
cpu_medium_thresh=$(get_tmux_option "@cpu_medium_thresh" "30")
|
local prefix=$2
|
||||||
cpu_high_thresh=$(get_tmux_option "@cpu_high_thresh" "80")
|
medium_thresh=$(get_tmux_option "@${prefix}_medium_thresh" "30")
|
||||||
if fcomp $cpu_high_thresh $percentage; then
|
high_thresh=$(get_tmux_option "@${prefix}_high_thresh" "80")
|
||||||
|
if fcomp "$high_thresh" "$percentage"; then
|
||||||
echo "high"
|
echo "high"
|
||||||
elif fcomp $cpu_medium_thresh $percentage && fcomp $percentage $cpu_high_thresh; then
|
elif fcomp "$medium_thresh" "$percentage" && fcomp "$percentage" "$high_thresh"; then
|
||||||
echo "medium"
|
echo "medium"
|
||||||
else
|
else
|
||||||
echo "low"
|
echo "low"
|
||||||
@ -59,12 +65,13 @@ load_status() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
temp_status() {
|
temp_status() {
|
||||||
local temp=$1
|
local temp
|
||||||
|
temp=$1
|
||||||
cpu_temp_medium_thresh=$(get_tmux_option "@cpu_temp_medium_thresh" "80")
|
cpu_temp_medium_thresh=$(get_tmux_option "@cpu_temp_medium_thresh" "80")
|
||||||
cpu_temp_high_thresh=$(get_tmux_option "@cpu_temp_high_thresh" "90")
|
cpu_temp_high_thresh=$(get_tmux_option "@cpu_temp_high_thresh" "90")
|
||||||
if fcomp $cpu_temp_high_thresh $temp; then
|
if fcomp "$cpu_temp_high_thresh" "$temp"; then
|
||||||
echo "high"
|
echo "high"
|
||||||
elif fcomp $cpu_temp_medium_thresh $temp && fcomp $temp $cpu_temp_high_thresh; then
|
elif fcomp "$cpu_temp_medium_thresh" "$temp" && fcomp "$temp" "$cpu_temp_high_thresh"; then
|
||||||
echo "medium"
|
echo "medium"
|
||||||
else
|
else
|
||||||
echo "low"
|
echo "low"
|
||||||
@ -84,12 +91,14 @@ cpus_number() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
command_exists() {
|
command_exists() {
|
||||||
local command="$1"
|
local command
|
||||||
|
command="$1"
|
||||||
command -v "$command" &>/dev/null
|
command -v "$command" &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
get_tmp_dir() {
|
get_tmp_dir() {
|
||||||
local tmpdir="${TMPDIR:-${TMP:-${TEMP:-/tmp}}}"
|
local tmpdir
|
||||||
|
tmpdir="${TMPDIR:-${TMP:-${TEMP:-/tmp}}}"
|
||||||
[ -d "$tmpdir" ] || local tmpdir=~/tmp
|
[ -d "$tmpdir" ] || local tmpdir=~/tmp
|
||||||
echo "$tmpdir/tmux-$EUID-cpu"
|
echo "$tmpdir/tmux-$EUID-cpu"
|
||||||
}
|
}
|
||||||
@ -99,31 +108,40 @@ get_time() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_cache_val() {
|
get_cache_val() {
|
||||||
local key="$1"
|
local key
|
||||||
|
local timeout
|
||||||
|
local cache
|
||||||
|
key="$1"
|
||||||
# seconds after which cache is invalidated
|
# seconds after which cache is invalidated
|
||||||
local timeout="${2:-2}"
|
timeout="${2:-2}"
|
||||||
local cache="$(get_tmp_dir)/$key"
|
cache="$(get_tmp_dir)/$key"
|
||||||
if [ -f "$cache" ]; then
|
if [ -f "$cache" ]; then
|
||||||
awk -v cache="$(head -n1 "$cache")" -v timeout=$timeout -v now=$(get_time) \
|
awk -v cache="$(head -n1 "$cache")" -v timeout="$timeout" -v now="$(get_time)" \
|
||||||
'BEGIN {if (now - timeout < cache) exit 0; exit 1}' \
|
'BEGIN {if (now - timeout < cache) exit 0; exit 1}' &&
|
||||||
&& tail -n+2 "$cache"
|
tail -n+2 "$cache"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
put_cache_val() {
|
put_cache_val() {
|
||||||
local key="$1"
|
local key
|
||||||
local val="${@:2}"
|
local val
|
||||||
local tmpdir="$(get_tmp_dir)"
|
local tmpdir
|
||||||
|
key="$1"
|
||||||
|
val="${*:2}"
|
||||||
|
tmpdir="$(get_tmp_dir)"
|
||||||
[ ! -d "$tmpdir" ] && mkdir -p "$tmpdir" && chmod 0700 "$tmpdir"
|
[ ! -d "$tmpdir" ] && mkdir -p "$tmpdir" && chmod 0700 "$tmpdir"
|
||||||
echo "$(get_time)" > "$tmpdir/$key"
|
get_time >"$tmpdir/$key"
|
||||||
echo -n "$val" >>"$tmpdir/$key"
|
echo -n "$val" >>"$tmpdir/$key"
|
||||||
echo -n "$val"
|
echo -n "$val"
|
||||||
}
|
}
|
||||||
|
|
||||||
cached_eval() {
|
cached_eval() {
|
||||||
local command="$1"
|
local command
|
||||||
local key="$(basename "$command")"
|
local key
|
||||||
local val="$(get_cache_val "$key")"
|
local val
|
||||||
|
command="$1"
|
||||||
|
key="$(basename "$command")"
|
||||||
|
val="$(get_cache_val "$key")"
|
||||||
if [ -z "$val" ]; then
|
if [ -z "$val" ]; then
|
||||||
put_cache_val "$key" "$($command "${@:2}")"
|
put_cache_val "$key" "$($command "${@:2}")"
|
||||||
else
|
else
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
ram_low_bg_color=""
|
ram_low_bg_color=""
|
||||||
@ -19,13 +20,15 @@ get_bg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_bg_color() {
|
print_bg_color() {
|
||||||
local ram_percentage=$($CURRENT_DIR/ram_percentage.sh | sed -e 's/%//')
|
local ram_percentage
|
||||||
local ram_load_status=$(load_status $ram_percentage)
|
local ram_load_status
|
||||||
if [ $ram_load_status == "low" ]; then
|
ram_percentage=$("$CURRENT_DIR"/ram_percentage.sh | sed -e 's/%//')
|
||||||
|
ram_load_status=$(load_status "$ram_percentage" "ram")
|
||||||
|
if [ "$ram_load_status" == "low" ]; then
|
||||||
echo "$ram_low_bg_color"
|
echo "$ram_low_bg_color"
|
||||||
elif [ $ram_load_status == "medium" ]; then
|
elif [ "$ram_load_status" == "medium" ]; then
|
||||||
echo "$ram_medium_bg_color"
|
echo "$ram_medium_bg_color"
|
||||||
elif [ $ram_load_status == "high" ]; then
|
elif [ "$ram_load_status" == "high" ]; then
|
||||||
echo "$ram_high_bg_color"
|
echo "$ram_high_bg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
ram_low_fg_color=""
|
ram_low_fg_color=""
|
||||||
@ -19,13 +20,15 @@ get_fg_color_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_fg_color() {
|
print_fg_color() {
|
||||||
local ram_percentage=$($CURRENT_DIR/ram_percentage.sh | sed -e 's/%//')
|
local ram_percentage
|
||||||
local ram_load_status=$(load_status $ram_percentage)
|
local ram_load_status
|
||||||
if [ $ram_load_status == "low" ]; then
|
ram_percentage=$("$CURRENT_DIR"/ram_percentage.sh | sed -e 's/%//')
|
||||||
|
ram_load_status=$(load_status "$ram_percentage" "ram")
|
||||||
|
if [ "$ram_load_status" == "low" ]; then
|
||||||
echo "$ram_low_fg_color"
|
echo "$ram_low_fg_color"
|
||||||
elif [ $ram_load_status == "medium" ]; then
|
elif [ "$ram_load_status" == "medium" ]; then
|
||||||
echo "$ram_medium_fg_color"
|
echo "$ram_medium_fg_color"
|
||||||
elif [ $ram_load_status == "high" ]; then
|
elif [ "$ram_load_status" == "high" ]; then
|
||||||
echo "$ram_high_fg_color"
|
echo "$ram_high_fg_color"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
# script global variables
|
# script global variables
|
||||||
@ -21,13 +22,15 @@ get_icon_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_icon() {
|
print_icon() {
|
||||||
local ram_percentage=$($CURRENT_DIR/ram_percentage.sh | sed -e 's/%//')
|
local ram_percentage
|
||||||
local ram_load_status=$(load_status $ram_percentage)
|
local ram_load_status
|
||||||
if [ $ram_load_status == "low" ]; then
|
ram_percentage=$("$CURRENT_DIR"/ram_percentage.sh | sed -e 's/%//')
|
||||||
|
ram_load_status=$(load_status "$ram_percentage" "ram")
|
||||||
|
if [ "$ram_load_status" == "low" ]; then
|
||||||
echo "$ram_low_icon"
|
echo "$ram_low_icon"
|
||||||
elif [ $ram_load_status == "medium" ]; then
|
elif [ "$ram_load_status" == "medium" ]; then
|
||||||
echo "$ram_medium_icon"
|
echo "$ram_medium_icon"
|
||||||
elif [ $ram_load_status == "high" ]; then
|
elif [ "$ram_load_status" == "high" ]; then
|
||||||
echo "$ram_high_icon"
|
echo "$ram_high_icon"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -36,4 +39,4 @@ main() {
|
|||||||
get_icon_settings
|
get_icon_settings
|
||||||
print_icon "$1"
|
print_icon "$1"
|
||||||
}
|
}
|
||||||
main
|
main "$@"
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/helpers.sh
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
|
|
||||||
ram_percentage_format="%3.1f%%"
|
ram_percentage_format="%3.1f%%"
|
||||||
|
|
||||||
sum_macos_vm_stats() {
|
sum_macos_vm_stats() {
|
||||||
grep -Eo '[0-9]+' \
|
grep -Eo '[0-9]+' |
|
||||||
| awk '{ a += $1 * 4096 } END { print a }'
|
awk '{ a += $1 * 4096 } END { print a }'
|
||||||
}
|
}
|
||||||
|
|
||||||
print_ram_percentage() {
|
print_ram_percentage() {
|
||||||
@ -20,23 +21,26 @@ print_ram_percentage() {
|
|||||||
# page size of 4096 bytes
|
# page size of 4096 bytes
|
||||||
stats="$(cached_eval vm_stat)"
|
stats="$(cached_eval vm_stat)"
|
||||||
|
|
||||||
used_and_cached=$(echo "$stats" \
|
used_and_cached=$(
|
||||||
| grep -E "(Pages active|Pages inactive|Pages speculative|Pages wired down|Pages occupied by compressor)" \
|
echo "$stats" |
|
||||||
| sum_macos_vm_stats \
|
grep -E "(Pages active|Pages inactive|Pages speculative|Pages wired down|Pages occupied by compressor)" |
|
||||||
|
sum_macos_vm_stats
|
||||||
)
|
)
|
||||||
|
|
||||||
cached=$(echo "$stats" \
|
cached=$(
|
||||||
| grep -E "(Pages purgeable|File-backed pages)" \
|
echo "$stats" |
|
||||||
| sum_macos_vm_stats \
|
grep -E "(Pages purgeable|File-backed pages)" |
|
||||||
|
sum_macos_vm_stats
|
||||||
)
|
)
|
||||||
|
|
||||||
free=$(echo "$stats" \
|
free=$(
|
||||||
| grep -E "(Pages free)" \
|
echo "$stats" |
|
||||||
| sum_macos_vm_stats \
|
grep -E "(Pages free)" |
|
||||||
|
sum_macos_vm_stats
|
||||||
)
|
)
|
||||||
|
|
||||||
used=$(($used_and_cached - $cached))
|
used=$((used_and_cached - cached))
|
||||||
total=$(($used_and_cached + $free))
|
total=$((used_and_cached + free))
|
||||||
|
|
||||||
echo "$used $total" | awk -v format="$ram_percentage_format" '{printf(format, 100*$1/$2)}'
|
echo "$used $total" | awk -v format="$ram_percentage_format" '{printf(format, 100*$1/$2)}'
|
||||||
fi
|
fi
|
||||||
|
@ -24,56 +24,60 @@ Tested and working on Linux, OSX and Cygwin.
|
|||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
# utf8 is on
|
```tmux
|
||||||
set -g utf8 on
|
# Address vim mode switching delay (http://superuser.com/a/252717/65504)
|
||||||
set -g status-utf8 on
|
|
||||||
|
|
||||||
# address vim mode switching delay (http://superuser.com/a/252717/65504)
|
|
||||||
set -s escape-time 0
|
set -s escape-time 0
|
||||||
|
|
||||||
# increase scrollback buffer size
|
# Increase scrollback buffer size from 2000 to 50000 lines
|
||||||
set -g history-limit 50000
|
set -g history-limit 50000
|
||||||
|
|
||||||
# tmux messages are displayed for 4 seconds
|
# Increase tmux messages display duration from 750ms to 4s
|
||||||
set -g display-time 4000
|
set -g display-time 4000
|
||||||
|
|
||||||
# refresh 'status-left' and 'status-right' more often
|
# Refresh 'status-left' and 'status-right' more often, from every 15s to 5s
|
||||||
set -g status-interval 5
|
set -g status-interval 5
|
||||||
|
|
||||||
# set only on OS X where it's required
|
# (OS X) Fix pbcopy/pbpaste for old tmux versions (pre 2.6)
|
||||||
set -g default-command "reattach-to-user-namespace -l $SHELL"
|
set -g default-command "reattach-to-user-namespace -l $SHELL"
|
||||||
|
|
||||||
# upgrade $TERM
|
# Upgrade $TERM
|
||||||
set -g default-terminal "screen-256color"
|
set -g default-terminal "screen-256color"
|
||||||
|
|
||||||
# emacs key bindings in tmux command prompt (prefix + :) are better than
|
# Emacs key bindings in tmux command prompt (prefix + :) are better than
|
||||||
# vi keys, even for vim users
|
# vi keys, even for vim users
|
||||||
set -g status-keys emacs
|
set -g status-keys emacs
|
||||||
|
|
||||||
# focus events enabled for terminals that support them
|
# Focus events enabled for terminals that support them
|
||||||
set -g focus-events on
|
set -g focus-events on
|
||||||
|
|
||||||
# super useful when using "grouped sessions" and multi-monitor setup
|
# Super useful when using "grouped sessions" and multi-monitor setup
|
||||||
setw -g aggressive-resize on
|
setw -g aggressive-resize on
|
||||||
|
```
|
||||||
|
|
||||||
### Key bindings
|
### Key bindings
|
||||||
|
|
||||||
# easier and faster switching between next/prev window
|
```tmux
|
||||||
|
# Easier and faster switching between next/prev window
|
||||||
bind C-p previous-window
|
bind C-p previous-window
|
||||||
bind C-n next-window
|
bind C-n next-window
|
||||||
|
```
|
||||||
|
|
||||||
Above bindings enhance the default `prefix + p` and `prefix + n` bindings by
|
Above bindings enhance the default `prefix + p` and `prefix + n` bindings by
|
||||||
allowing you to hold `Ctrl` and repeat `a + p`/`a + n` (if your prefix is
|
allowing you to hold `Ctrl` and repeat `a + p`/`a + n` (if your prefix is
|
||||||
`C-a`), which is a lot quicker.
|
`C-a`), which is a lot quicker.
|
||||||
|
|
||||||
# source .tmux.conf as suggested in `man tmux`
|
```tmux
|
||||||
|
# Source .tmux.conf as suggested in `man tmux`
|
||||||
bind R source-file '~/.tmux.conf'
|
bind R source-file '~/.tmux.conf'
|
||||||
|
```
|
||||||
|
|
||||||
"Adaptable" key bindings that build upon your `prefix` value:
|
"Adaptable" key bindings that build upon your `prefix` value:
|
||||||
|
|
||||||
# if prefix is 'C-a'
|
```tmux
|
||||||
|
# If prefix is 'C-a'
|
||||||
bind C-a send-prefix
|
bind C-a send-prefix
|
||||||
bind a last-window
|
bind a last-window
|
||||||
|
```
|
||||||
|
|
||||||
If prefix is `C-b`, above keys will be `C-b` and `b`.<br/>
|
If prefix is `C-b`, above keys will be `C-b` and `b`.<br/>
|
||||||
If prefix is `C-z`, above keys will be `C-z` and `z`... you get the idea.
|
If prefix is `C-z`, above keys will be `C-z` and `z`... you get the idea.
|
||||||
@ -82,7 +86,9 @@ If prefix is `C-z`, above keys will be `C-z` and `z`... you get the idea.
|
|||||||
|
|
||||||
Add plugin to the list of TPM plugins in `.tmux.conf`:
|
Add plugin to the list of TPM plugins in `.tmux.conf`:
|
||||||
|
|
||||||
|
```tmux
|
||||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||||
|
```
|
||||||
|
|
||||||
Hit `prefix + I` to fetch the plugin and source it. That's it!
|
Hit `prefix + I` to fetch the plugin and source it. That's it!
|
||||||
|
|
||||||
@ -94,7 +100,9 @@ Clone the repo:
|
|||||||
|
|
||||||
Add this line to the bottom of `.tmux.conf`:
|
Add this line to the bottom of `.tmux.conf`:
|
||||||
|
|
||||||
|
```tmux
|
||||||
run-shell ~/clone/path/sensible.tmux
|
run-shell ~/clone/path/sensible.tmux
|
||||||
|
```
|
||||||
|
|
||||||
Reload TMUX environment with `$ tmux source-file ~/.tmux.conf`, and that's it.
|
Reload TMUX environment with `$ tmux source-file ~/.tmux.conf`, and that's it.
|
||||||
|
|
||||||
|
29
tmux/.tmux/plugins/tmux-sensible/sensible.tmux
Normal file → Executable file
29
tmux/.tmux/plugins/tmux-sensible/sensible.tmux
Normal file → Executable file
@ -11,7 +11,7 @@ is_osx() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
iterm_terminal() {
|
iterm_terminal() {
|
||||||
[[ "$TERM_PROGRAM" =~ ^iTerm ]]
|
[[ "${TERM_PROGRAM}" =~ ^iTerm || "${LC_TERMINAL}" =~ ^iTerm ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
command_exists() {
|
command_exists() {
|
||||||
@ -45,7 +45,7 @@ server_option_value_not_changed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
key_binding_not_set() {
|
key_binding_not_set() {
|
||||||
local key="$1"
|
local key="${1//\\/\\\\}"
|
||||||
if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]"); then
|
if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]"); then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@ -64,15 +64,20 @@ key_binding_not_changed() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_tmux_config() {
|
||||||
|
local tmux_config_xdg="${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf"
|
||||||
|
local tmux_config="$HOME/.tmux.conf"
|
||||||
|
|
||||||
|
if [ -f "${tmux_config_xdg}" ]; then
|
||||||
|
echo "${tmux_config_xdg}"
|
||||||
|
else
|
||||||
|
echo ${tmux_config}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
|
||||||
# enable utf8 (option removed in tmux 2.2)
|
|
||||||
tmux set-option -g utf8 on 2>/dev/null
|
|
||||||
|
|
||||||
# enable utf8 in tmux status-left and status-right (option removed in tmux 2.2)
|
|
||||||
tmux set-option -g status-utf8 on 2>/dev/null
|
|
||||||
|
|
||||||
# address vim mode switching delay (http://superuser.com/a/252717/65504)
|
# address vim mode switching delay (http://superuser.com/a/252717/65504)
|
||||||
if server_option_value_not_changed "escape-time" "500"; then
|
if server_option_value_not_changed "escape-time" "500"; then
|
||||||
tmux set-option -s escape-time 0
|
tmux set-option -s escape-time 0
|
||||||
@ -153,9 +158,11 @@ main() {
|
|||||||
|
|
||||||
# source `.tmux.conf` file - as suggested in `man tmux`
|
# source `.tmux.conf` file - as suggested in `man tmux`
|
||||||
if key_binding_not_set "R"; then
|
if key_binding_not_set "R"; then
|
||||||
tmux bind-key R run-shell ' \
|
local tmux_config=$(get_tmux_config)
|
||||||
tmux source-file ~/.tmux.conf > /dev/null; \
|
|
||||||
tmux display-message "Sourced .tmux.conf!"'
|
tmux bind-key R run-shell " \
|
||||||
|
tmux source-file ${tmux_config} > /dev/null; \
|
||||||
|
tmux display-message 'Sourced ${tmux_config}!'"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
main
|
main
|
||||||
|
@ -76,6 +76,8 @@ without `reattach-to-user-namespace`. It doesn't hurt to have it installed.
|
|||||||
- OS X 10.10: Yosemite – *not required*
|
- OS X 10.10: Yosemite – *not required*
|
||||||
- OS X 10.11: El Capitan – *not required*
|
- OS X 10.11: El Capitan – *not required*
|
||||||
- macOS 10.12: Sierra – *required*
|
- macOS 10.12: Sierra – *required*
|
||||||
|
- macOS 10.14: Mojave - *required*
|
||||||
|
- macOS 10.15: Catalina - *not required*
|
||||||
|
|
||||||
The easiest way to use `reattach-to-user-namespace` with `tmux` is use to
|
The easiest way to use `reattach-to-user-namespace` with `tmux` is use to
|
||||||
use the [`tmux-sensible`](https://github.com/tmux-plugins/tmux-sensible)
|
use the [`tmux-sensible`](https://github.com/tmux-plugins/tmux-sensible)
|
||||||
|
0
tmux/.tmux/plugins/tmux-yank/citest
Normal file → Executable file
0
tmux/.tmux/plugins/tmux-yank/citest
Normal file → Executable file
0
tmux/.tmux/plugins/tmux-yank/scripts/copy_line.sh
Normal file → Executable file
0
tmux/.tmux/plugins/tmux-yank/scripts/copy_line.sh
Normal file → Executable file
5
tmux/.tmux/plugins/tmux-yank/scripts/copy_pane_pwd.sh
Normal file → Executable file
5
tmux/.tmux/plugins/tmux-yank/scripts/copy_pane_pwd.sh
Normal file → Executable file
@ -16,10 +16,13 @@ display_notice() {
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
local copy_command
|
local copy_command
|
||||||
|
local payload
|
||||||
# shellcheck disable=SC2119
|
# shellcheck disable=SC2119
|
||||||
copy_command="$(clipboard_copy_command)"
|
copy_command="$(clipboard_copy_command)"
|
||||||
|
payload="$(pane_current_path | tr -d '\n')"
|
||||||
# $copy_command below should not be quoted
|
# $copy_command below should not be quoted
|
||||||
pane_current_path | tr -d '\n' | $copy_command
|
echo "$payload" | $copy_command
|
||||||
|
tmux set-buffer "$payload"
|
||||||
display_notice
|
display_notice
|
||||||
}
|
}
|
||||||
main
|
main
|
||||||
|
@ -174,7 +174,7 @@ clipboard_copy_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Cache the TMUX version for speed.
|
# Cache the TMUX version for speed.
|
||||||
tmux_version="$(tmux -V | cut -d ' ' -f 2)"
|
tmux_version="$(tmux -V | cut -d ' ' -f 2 | sed 's/next-//')"
|
||||||
|
|
||||||
tmux_is_at_least() {
|
tmux_is_at_least() {
|
||||||
if [[ $tmux_version == "$1" ]] || [[ $tmux_version == master ]]; then
|
if [[ $tmux_version == "$1" ]] || [[ $tmux_version == master ]]; then
|
||||||
@ -200,6 +200,9 @@ tmux_is_at_least() {
|
|||||||
if ((10#${current_version[i]} < 10#${wanted_version[i]})); then
|
if ((10#${current_version[i]} < 10#${wanted_version[i]})); then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
if ((10#${current_version[i]} > 10#${wanted_version[i]})); then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
0
tmux/.tmux/plugins/tmux-yank/yank.tmux
Normal file → Executable file
0
tmux/.tmux/plugins/tmux-yank/yank.tmux
Normal file → Executable file
21
tmux/.tmux/plugins/tmux/LICENSE
Normal file
21
tmux/.tmux/plugins/tmux/LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021 Catppuccin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
58
tmux/.tmux/plugins/tmux/README.md
Normal file
58
tmux/.tmux/plugins/tmux/README.md
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<h3 align="center">
|
||||||
|
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/logos/exports/1544x1544_circle.png" width="100" alt="Logo"/><br/>
|
||||||
|
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
|
||||||
|
Catppuccin for <a href="https://github.com/tmux/tmux">Tmux</a>
|
||||||
|
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/catppuccin/tmux/stargazers"><img src="https://img.shields.io/github/stars/catppuccin/tmux?colorA=363a4f&colorB=b7bdf8&style=for-the-badge"></a>
|
||||||
|
<a href="https://github.com/catppuccin/tmux/issues"><img src="https://img.shields.io/github/issues/catppuccin/tmux?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a>
|
||||||
|
<a href="https://github.com/catppuccin/tmux/contributors"><img src="https://img.shields.io/github/contributors/catppuccin/tmux?colorA=363a4f&colorB=a6da95&style=for-the-badge"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="./assets/preview.webp"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Themes
|
||||||
|
|
||||||
|
- 🌻 [Latte](./catppuccin-latte.tmuxtheme)
|
||||||
|
- 🪴 [Frappé](./catppuccin-frappe.tmuxtheme)
|
||||||
|
- 🌺 [Macchiato](./catppuccin-macchiato.tmuxtheme)
|
||||||
|
- 🌿 [Mocha](./catppuccin-mocha.tmuxtheme)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### TPM
|
||||||
|
|
||||||
|
1. Install [TPM](https://github.com/tmux-plugins/tpm)
|
||||||
|
2. Add the Catppuccin plugin:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
set -g @plugin 'catppuccin/tmux'
|
||||||
|
# ...alongside
|
||||||
|
set -g @plugin 'tmux-plugins/tpm'
|
||||||
|
```
|
||||||
|
|
||||||
|
3. (Optional) Set your preferred flavour, it defaults to `"mocha"`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
set -g @catppuccin_flavour 'latte' # or frappe, macchiato, mocha
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manual
|
||||||
|
|
||||||
|
1. Copy your desired theme's configuration contents into your Tmux config (usually stored at `~/.tmux.conf`)
|
||||||
|
2. Reload Tmux by either restarting the session or reloading it with `tmux source-file ~/.tmux.conf`
|
||||||
|
|
||||||
|
## 💝 Thanks to
|
||||||
|
|
||||||
|
- [Pocco81](https://github.com/catppuccin)
|
||||||
|
- [vinnyA3](https://github.com/vinnyA3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p align="center"><img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/footers/gray0_ctp_on_line.svg?sanitize=true" /></p>
|
||||||
|
<p align="center">Copyright © 2021-present <a href="https://github.com/catppuccin" target="_blank">Catppuccin Org</a>
|
||||||
|
<p align="center"><a href="https://github.com/catppuccin/catppuccin/blob/main/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8"/></a></p>
|
BIN
tmux/.tmux/plugins/tmux/assets/frappe.webp
Normal file
BIN
tmux/.tmux/plugins/tmux/assets/frappe.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
BIN
tmux/.tmux/plugins/tmux/assets/latte.webp
Normal file
BIN
tmux/.tmux/plugins/tmux/assets/latte.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 98 KiB |
BIN
tmux/.tmux/plugins/tmux/assets/macchiato.webp
Normal file
BIN
tmux/.tmux/plugins/tmux/assets/macchiato.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
BIN
tmux/.tmux/plugins/tmux/assets/mocha.webp
Normal file
BIN
tmux/.tmux/plugins/tmux/assets/mocha.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
BIN
tmux/.tmux/plugins/tmux/assets/preview.webp
Normal file
BIN
tmux/.tmux/plugins/tmux/assets/preview.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 159 KiB |
71
tmux/.tmux/plugins/tmux/catppuccin-frappe.tmuxtheme
Executable file
71
tmux/.tmux/plugins/tmux/catppuccin-frappe.tmuxtheme
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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 (Frappe)
|
||||||
|
thm_bg="#303446"
|
||||||
|
thm_fg="#c6d0f5"
|
||||||
|
thm_cyan="#99d1db"
|
||||||
|
thm_black="#292c3c"
|
||||||
|
thm_gray="#414559"
|
||||||
|
thm_magenta="#ca9ee6"
|
||||||
|
thm_pink="#f4b8e4"
|
||||||
|
thm_red="#e78284"
|
||||||
|
thm_green="#a6d189"
|
||||||
|
thm_yellow="#e5c890"
|
||||||
|
thm_blue="#8caaee"
|
||||||
|
thm_orange="#ef9f76"
|
||||||
|
thm_black4="#626880"
|
||||||
|
|
||||||
|
# ----------------------------=== Theme ===--------------------------
|
||||||
|
|
||||||
|
# utils
|
||||||
|
set() {
|
||||||
|
local option=$1
|
||||||
|
local value=$2
|
||||||
|
tmux set-option -gq "$option" "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
setw() {
|
||||||
|
local option=$1
|
||||||
|
local value=$2
|
||||||
|
tmux set-window-option -gq "$option" "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
# status
|
||||||
|
set status "on"
|
||||||
|
set status-bg "${thm_bg}"
|
||||||
|
set status-justify "left"
|
||||||
|
set status-left-length "100"
|
||||||
|
set status-right-length "100"
|
||||||
|
|
||||||
|
# messages
|
||||||
|
set message-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
|
||||||
|
set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
|
||||||
|
|
||||||
|
# panes
|
||||||
|
set pane-border-style "fg=${thm_gray}"
|
||||||
|
set pane-active-border-style "fg=${thm_blue}"
|
||||||
|
|
||||||
|
# windows
|
||||||
|
setw window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none"
|
||||||
|
setw window-status-separator ""
|
||||||
|
setw window-status-style "fg=${thm_fg},bg=${thm_bg},none"
|
||||||
|
|
||||||
|
# --------=== Statusline
|
||||||
|
|
||||||
|
set status-left ""
|
||||||
|
set status-right "#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #[fg=$thm_fg,bg=$thm_gray] #W #{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}#[bg=$thm_gray]#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg] #[fg=$thm_fg,bg=$thm_gray] #S "
|
||||||
|
|
||||||
|
# current_dir
|
||||||
|
setw window-status-format "#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} "
|
||||||
|
setw window-status-current-format "#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #{b:pane_current_path} "
|
||||||
|
|
||||||
|
# parent_dir/current_dir
|
||||||
|
# setw window-status-format "#[fg=colour232,bg=colour111] #I #[fg=colour222,bg=colour235] #(echo '#{pane_current_path}' | rev | cut -d'/' -f-2 | rev) "
|
||||||
|
# setw window-status-current-format "#[fg=colour232,bg=colour208] #I #[fg=colour255,bg=colour237] #(echo '#{pane_current_path}' | rev | cut -d'/' -f-2 | rev) "
|
||||||
|
|
||||||
|
# --------=== Modes
|
||||||
|
setw clock-mode-colour "${thm_blue}"
|
||||||
|
setw mode-style "fg=${thm_pink} bg=${thm_black4} bold"
|
71
tmux/.tmux/plugins/tmux/catppuccin-latte.tmuxtheme
Executable file
71
tmux/.tmux/plugins/tmux/catppuccin-latte.tmuxtheme
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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 (Latte)
|
||||||
|
thm_bg="#dce0e8"
|
||||||
|
thm_fg="#4c4f69"
|
||||||
|
thm_cyan="#179299"
|
||||||
|
thm_black="#e6e9ef"
|
||||||
|
thm_gray="#bcc0cc"
|
||||||
|
thm_magenta="#ea76cb"
|
||||||
|
thm_pink="#8839ef"
|
||||||
|
thm_red="#d20f39"
|
||||||
|
thm_green="#40a02b"
|
||||||
|
thm_yellow="#df8e1d"
|
||||||
|
thm_blue="#1e66f5"
|
||||||
|
thm_orange="#fe640b"
|
||||||
|
thm_black4="#acb0be"
|
||||||
|
|
||||||
|
# ----------------------------=== Theme ===--------------------------
|
||||||
|
|
||||||
|
# utils
|
||||||
|
set() {
|
||||||
|
local option=$1
|
||||||
|
local value=$2
|
||||||
|
tmux set-option -gq "$option" "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
setw() {
|
||||||
|
local option=$1
|
||||||
|
local value=$2
|
||||||
|
tmux set-window-option -gq "$option" "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
# status
|
||||||
|
set status "on"
|
||||||
|
set status-bg "${thm_bg}"
|
||||||
|
set status-justify "left"
|
||||||
|
set status-left-length "100"
|
||||||
|
set status-right-length "100"
|
||||||
|
|
||||||
|
# messages
|
||||||
|
set message-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
|
||||||
|
set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
|
||||||
|
|
||||||
|
# panes
|
||||||
|
set pane-border-style "fg=${thm_gray}"
|
||||||
|
set pane-active-border-style "fg=${thm_blue}"
|
||||||
|
|
||||||
|
# windows
|
||||||
|
setw window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none"
|
||||||
|
setw window-status-separator ""
|
||||||
|
setw window-status-style "fg=${thm_fg},bg=${thm_bg},none"
|
||||||
|
|
||||||
|
# --------=== Statusline
|
||||||
|
|
||||||
|
set status-left ""
|
||||||
|
set status-right "#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #[fg=$thm_fg,bg=$thm_gray] #W #{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}#[bg=$thm_gray]#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg] #[fg=$thm_fg,bg=$thm_gray] #S "
|
||||||
|
|
||||||
|
# current_dir
|
||||||
|
setw window-status-format "#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} "
|
||||||
|
setw window-status-current-format "#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #{b:pane_current_path} "
|
||||||
|
|
||||||
|
# parent_dir/current_dir
|
||||||
|
# setw window-status-format "#[fg=colour232,bg=colour111] #I #[fg=colour222,bg=colour235] #(echo '#{pane_current_path}' | rev | cut -d'/' -f-2 | rev) "
|
||||||
|
# setw window-status-current-format "#[fg=colour232,bg=colour208] #I #[fg=colour255,bg=colour237] #(echo '#{pane_current_path}' | rev | cut -d'/' -f-2 | rev) "
|
||||||
|
|
||||||
|
# --------=== Modes
|
||||||
|
setw clock-mode-colour "${thm_blue}"
|
||||||
|
setw mode-style "fg=${thm_pink} bg=${thm_black4} bold"
|
71
tmux/.tmux/plugins/tmux/catppuccin-macchiato.tmuxtheme
Executable file
71
tmux/.tmux/plugins/tmux/catppuccin-macchiato.tmuxtheme
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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 (Macchiato)
|
||||||
|
thm_bg="#24273a"
|
||||||
|
thm_fg="#cad3f5"
|
||||||
|
thm_cyan="#91d7e3"
|
||||||
|
thm_black="#1e2030"
|
||||||
|
thm_gray="#363a4f"
|
||||||
|
thm_magenta="#c6a0f6"
|
||||||
|
thm_pink="#f5bde6"
|
||||||
|
thm_red="#ed8796"
|
||||||
|
thm_green="#a6da95"
|
||||||
|
thm_yellow="#eed49f"
|
||||||
|
thm_blue="#8aadf4"
|
||||||
|
thm_orange="#f5a97f"
|
||||||
|
thm_black4="#5b6078"
|
||||||
|
|
||||||
|
# ----------------------------=== Theme ===--------------------------
|
||||||
|
|
||||||
|
# utils
|
||||||
|
set() {
|
||||||
|
local option=$1
|
||||||
|
local value=$2
|
||||||
|
tmux set-option -gq "$option" "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
setw() {
|
||||||
|
local option=$1
|
||||||
|
local value=$2
|
||||||
|
tmux set-window-option -gq "$option" "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
# status
|
||||||
|
set status "on"
|
||||||
|
set status-bg "${thm_bg}"
|
||||||
|
set status-justify "left"
|
||||||
|
set status-left-length "100"
|
||||||
|
set status-right-length "100"
|
||||||
|
|
||||||
|
# messages
|
||||||
|
set message-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
|
||||||
|
set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
|
||||||
|
|
||||||
|
# panes
|
||||||
|
set pane-border-style "fg=${thm_gray}"
|
||||||
|
set pane-active-border-style "fg=${thm_blue}"
|
||||||
|
|
||||||
|
# windows
|
||||||
|
setw window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none"
|
||||||
|
setw window-status-separator ""
|
||||||
|
setw window-status-style "fg=${thm_fg},bg=${thm_bg},none"
|
||||||
|
|
||||||
|
# --------=== Statusline
|
||||||
|
|
||||||
|
set status-left ""
|
||||||
|
set status-right "#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #[fg=$thm_fg,bg=$thm_gray] #W #{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}#[bg=$thm_gray]#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg] #[fg=$thm_fg,bg=$thm_gray] #S "
|
||||||
|
|
||||||
|
# current_dir
|
||||||
|
setw window-status-format "#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #W "
|
||||||
|
setw window-status-current-format "#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #W "
|
||||||
|
|
||||||
|
# parent_dir/current_dir
|
||||||
|
# setw window-status-format "#[fg=colour232,bg=colour111] #I #[fg=colour222,bg=colour235] #(echo '#{pane_current_path}' | rev | cut -d'/' -f-2 | rev) "
|
||||||
|
# setw window-status-current-format "#[fg=colour232,bg=colour208] #I #[fg=colour255,bg=colour237] #(echo '#{pane_current_path}' | rev | cut -d'/' -f-2 | rev) "
|
||||||
|
|
||||||
|
# --------=== Modes
|
||||||
|
setw clock-mode-colour "${thm_blue}"
|
||||||
|
setw mode-style "fg=${thm_pink} bg=${thm_black4} bold"
|
71
tmux/.tmux/plugins/tmux/catppuccin-mocha.tmuxtheme
Executable file
71
tmux/.tmux/plugins/tmux/catppuccin-mocha.tmuxtheme
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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 (Mocha)
|
||||||
|
thm_bg="#1e1e2e"
|
||||||
|
thm_fg="#cdd6f4"
|
||||||
|
thm_cyan="#89dceb"
|
||||||
|
thm_black="#181825"
|
||||||
|
thm_gray="#313244"
|
||||||
|
thm_magenta="#cba6f7"
|
||||||
|
thm_pink="#f5c2e7"
|
||||||
|
thm_red="#f38ba8"
|
||||||
|
thm_green="#a6e3a1"
|
||||||
|
thm_yellow="#f9e2af"
|
||||||
|
thm_blue="#89b4fa"
|
||||||
|
thm_orange="#fab387"
|
||||||
|
thm_black4="#585b70"
|
||||||
|
|
||||||
|
# ----------------------------=== Theme ===--------------------------
|
||||||
|
|
||||||
|
# utils
|
||||||
|
set() {
|
||||||
|
local option=$1
|
||||||
|
local value=$2
|
||||||
|
tmux set-option -gq "$option" "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
setw() {
|
||||||
|
local option=$1
|
||||||
|
local value=$2
|
||||||
|
tmux set-window-option -gq "$option" "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
# status
|
||||||
|
set status "on"
|
||||||
|
set status-bg "${thm_bg}"
|
||||||
|
set status-justify "left"
|
||||||
|
set status-left-length "100"
|
||||||
|
set status-right-length "100"
|
||||||
|
|
||||||
|
# messages
|
||||||
|
set message-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
|
||||||
|
set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
|
||||||
|
|
||||||
|
# panes
|
||||||
|
set pane-border-style "fg=${thm_gray}"
|
||||||
|
set pane-active-border-style "fg=${thm_blue}"
|
||||||
|
|
||||||
|
# windows
|
||||||
|
setw window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none"
|
||||||
|
setw window-status-separator ""
|
||||||
|
setw window-status-style "fg=${thm_fg},bg=${thm_bg},none"
|
||||||
|
|
||||||
|
# --------=== Statusline
|
||||||
|
|
||||||
|
set status-left ""
|
||||||
|
set status-right "#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #[fg=$thm_fg,bg=$thm_gray] #W #{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}#[bg=$thm_gray]#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg] #[fg=$thm_fg,bg=$thm_gray] #S "
|
||||||
|
|
||||||
|
# current_dir
|
||||||
|
setw window-status-format "#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} "
|
||||||
|
setw window-status-current-format "#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #{b:pane_current_path} "
|
||||||
|
|
||||||
|
# parent_dir/current_dir
|
||||||
|
# setw window-status-format "#[fg=colour232,bg=colour111] #I #[fg=colour222,bg=colour235] #(echo '#{pane_current_path}' | rev | cut -d'/' -f-2 | rev) "
|
||||||
|
# setw window-status-current-format "#[fg=colour232,bg=colour208] #I #[fg=colour255,bg=colour237] #(echo '#{pane_current_path}' | rev | cut -d'/' -f-2 | rev) "
|
||||||
|
|
||||||
|
# --------=== Modes
|
||||||
|
setw clock-mode-colour "${thm_blue}"
|
||||||
|
setw mode-style "fg=${thm_pink} bg=${thm_black4} bold"
|
23
tmux/.tmux/plugins/tmux/catppuccin.tmux
Executable file
23
tmux/.tmux/plugins/tmux/catppuccin.tmux
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
get-tmux-option() {
|
||||||
|
local option value default
|
||||||
|
option="$1"
|
||||||
|
default="$2"
|
||||||
|
value="$(tmux show-option -gqv "$option")"
|
||||||
|
|
||||||
|
if [ -n "$value" ]; then
|
||||||
|
echo "$value"
|
||||||
|
else
|
||||||
|
echo "$default"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
local theme
|
||||||
|
theme="$(get-tmux-option "@catppuccin_flavour" "mocha")"
|
||||||
|
tmux run -b "$CURRENT_DIR/catppuccin-${theme}.tmuxtheme"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
@ -92,12 +92,12 @@ That should set up the key binding. Now hit `prefix + T` and see if it works.
|
|||||||
### 6. publish the plugin
|
### 6. publish the plugin
|
||||||
|
|
||||||
When everything is ready, push the plugin to an online git repository,
|
When everything is ready, push the plugin to an online git repository,
|
||||||
preferably Github.
|
preferably GitHub.
|
||||||
|
|
||||||
Other users can install your plugin by just adding plugin git URL to the
|
Other users can install your plugin by just adding plugin git URL to the
|
||||||
`@plugin` list in their `.tmux.conf`.
|
`@plugin` list in their `.tmux.conf`.
|
||||||
|
|
||||||
If the plugin is on Github, your users will be able to use the shorthand of
|
If the plugin is on GitHub, your users will be able to use the shorthand of
|
||||||
`github_username/repository`.
|
`github_username/repository`.
|
||||||
|
|
||||||
### Conclusion
|
### Conclusion
|
||||||
|
1
tmux/.tmux/plugins/tpm/lib/tmux-test
Submodule
1
tmux/.tmux/plugins/tpm/lib/tmux-test
Submodule
Submodule tmux/.tmux/plugins/tpm/lib/tmux-test added at 33fa65fbfb
@ -26,7 +26,7 @@ clone() {
|
|||||||
|
|
||||||
# tries cloning:
|
# tries cloning:
|
||||||
# 1. plugin name directly - works if it's a valid git url
|
# 1. plugin name directly - works if it's a valid git url
|
||||||
# 2. expands the plugin name to point to a github repo and tries cloning again
|
# 2. expands the plugin name to point to a GitHub repo and tries cloning again
|
||||||
clone_plugin() {
|
clone_plugin() {
|
||||||
local plugin="$1"
|
local plugin="$1"
|
||||||
local branch="$2"
|
local branch="$2"
|
||||||
|
@ -115,16 +115,16 @@ Add the following to your `~/.vimrc` to define your custom maps:
|
|||||||
``` vim
|
``` vim
|
||||||
let g:tmux_navigator_no_mappings = 1
|
let g:tmux_navigator_no_mappings = 1
|
||||||
|
|
||||||
nnoremap <silent> {Left-Mapping} :TmuxNavigateLeft<cr>
|
noremap <silent> {Left-Mapping} :<C-U>TmuxNavigateLeft<cr>
|
||||||
nnoremap <silent> {Down-Mapping} :TmuxNavigateDown<cr>
|
noremap <silent> {Down-Mapping} :<C-U>TmuxNavigateDown<cr>
|
||||||
nnoremap <silent> {Up-Mapping} :TmuxNavigateUp<cr>
|
noremap <silent> {Up-Mapping} :<C-U>TmuxNavigateUp<cr>
|
||||||
nnoremap <silent> {Right-Mapping} :TmuxNavigateRight<cr>
|
noremap <silent> {Right-Mapping} :<C-U>TmuxNavigateRight<cr>
|
||||||
nnoremap <silent> {Previous-Mapping} :TmuxNavigatePrevious<cr>
|
noremap <silent> {Previous-Mapping} :<C-U>TmuxNavigatePrevious<cr>
|
||||||
```
|
```
|
||||||
|
|
||||||
*Note* Each instance of `{Left-Mapping}` or `{Down-Mapping}` must be replaced
|
*Note* Each instance of `{Left-Mapping}` or `{Down-Mapping}` must be replaced
|
||||||
in the above code with the desired mapping. Ie, the mapping for `<ctrl-h>` =>
|
in the above code with the desired mapping. Ie, the mapping for `<ctrl-h>` =>
|
||||||
Left would be created with `nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>`.
|
Left would be created with `noremap <silent> <c-h> :<C-U>TmuxNavigateLeft<cr>`.
|
||||||
|
|
||||||
##### Autosave on leave
|
##### Autosave on leave
|
||||||
|
|
||||||
@ -199,6 +199,33 @@ With this enabled you can use `<prefix> C-l` to clear the screen.
|
|||||||
|
|
||||||
Thanks to [Brian Hogan][] for the tip on how to re-map the clear screen binding.
|
Thanks to [Brian Hogan][] for the tip on how to re-map the clear screen binding.
|
||||||
|
|
||||||
|
#### Disable Wrapping
|
||||||
|
|
||||||
|
By default, if you tru to move past the edge of the screen, tmux/vim will
|
||||||
|
"wrap" around to the opposite side. To disable this, you'll need to
|
||||||
|
configure both tmux and vim:
|
||||||
|
|
||||||
|
For vim, you only need to enable this option:
|
||||||
|
```vim
|
||||||
|
let g:tmux_navigator_no_wrap = 1
|
||||||
|
```
|
||||||
|
|
||||||
|
Tmux doesn't haave an option, so whatever key bindings you have need to be set
|
||||||
|
to conditionally wrap based on position on screen:
|
||||||
|
```tmux
|
||||||
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||||
|
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
||||||
|
bind-key -n 'C-h' if-shell "$is_vim" { send-keys C-h } { if-shell -F '#{pane_at_left}' {} { select-pane -L } }
|
||||||
|
bind-key -n 'C-j' if-shell "$is_vim" { send-keys C-j } { if-shell -F '#{pane_at_bottom}' {} { select-pane -D } }
|
||||||
|
bind-key -n 'C-k' if-shell "$is_vim" { send-keys C-k } { if-shell -F '#{pane_at_top}' {} { select-pane -U } }
|
||||||
|
bind-key -n 'C-l' if-shell "$is_vim" { send-keys C-l } { if-shell -F '#{pane_at_right}' {} { select-pane -R } }
|
||||||
|
|
||||||
|
bind-key -T copy-mode-vi 'C-h' if-shell -F '#{pane_at_left}' {} { select-pane -L }
|
||||||
|
bind-key -T copy-mode-vi 'C-j' if-shell -F '#{pane_at_bottom}' {} { select-pane -D }
|
||||||
|
bind-key -T copy-mode-vi 'C-k' if-shell -F '#{pane_at_top}' {} { select-pane -U }
|
||||||
|
bind-key -T copy-mode-vi 'C-l' if-shell -F '#{pane_at_right}' {} { select-pane -R }
|
||||||
|
```
|
||||||
|
|
||||||
#### Nesting
|
#### Nesting
|
||||||
If you like to nest your tmux sessions, this plugin is not going to work
|
If you like to nest your tmux sessions, this plugin is not going to work
|
||||||
properly. It probably never will, as it would require detecting when Tmux would
|
properly. It probably never will, as it would require detecting when Tmux would
|
||||||
@ -236,7 +263,7 @@ Troubleshooting
|
|||||||
|
|
||||||
This is likely due to conflicting key mappings in your `~/.vimrc`. You can use
|
This is likely due to conflicting key mappings in your `~/.vimrc`. You can use
|
||||||
the following search pattern to find conflicting mappings
|
the following search pattern to find conflicting mappings
|
||||||
`\vn(nore)?map\s+\<c-[hjkl]\>`. Any matching lines should be deleted or
|
`\v(nore)?map\s+\<c-[hjkl]\>`. Any matching lines should be deleted or
|
||||||
altered to avoid conflicting with the mappings from the plugin.
|
altered to avoid conflicting with the mappings from the plugin.
|
||||||
|
|
||||||
Another option is that the pattern matching included in the `.tmux.conf` is
|
Another option is that the pattern matching included in the `.tmux.conf` is
|
||||||
|
@ -30,10 +30,10 @@ CONFIGURATION *tmux-navigator-configuration*
|
|||||||
* Custom Key Bindings
|
* Custom Key Bindings
|
||||||
let g:tmux_navigator_no_mappings = 1
|
let g:tmux_navigator_no_mappings = 1
|
||||||
|
|
||||||
nnoremap <silent> {Left-mapping} :TmuxNavigateLeft<cr>
|
noremap <silent> {Left-mapping} :<C-U>TmuxNavigateLeft<cr>
|
||||||
nnoremap <silent> {Down-Mapping} :TmuxNavigateDown<cr>
|
noremap <silent> {Down-Mapping} :<C-U>TmuxNavigateDown<cr>
|
||||||
nnoremap <silent> {Up-Mapping} :TmuxNavigateUp<cr>
|
noremap <silent> {Up-Mapping} :<C-U>TmuxNavigateUp<cr>
|
||||||
nnoremap <silent> {Right-Mapping} :TmuxNavigateRight<cr>
|
noremap <silent> {Right-Mapping} :<C-U>TmuxNavigateRight<cr>
|
||||||
nnoremap <silent> {Previous-Mapping} :TmuxNavigatePrevious<cr>
|
noremap <silent> {Previous-Mapping} :<C-U><C-U>TmuxNavigatePrevious<cr>
|
||||||
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
vim:tw=78:ts=8:ft=help:norl:
|
||||||
|
@ -16,11 +16,11 @@ function! s:VimNavigate(direction)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if !get(g:, 'tmux_navigator_no_mappings', 0)
|
if !get(g:, 'tmux_navigator_no_mappings', 0)
|
||||||
nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>
|
noremap <silent> <c-h> :<C-U>TmuxNavigateLeft<cr>
|
||||||
nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
|
noremap <silent> <c-j> :<C-U>TmuxNavigateDown<cr>
|
||||||
nnoremap <silent> <c-k> :TmuxNavigateUp<cr>
|
noremap <silent> <c-k> :<C-U>TmuxNavigateUp<cr>
|
||||||
nnoremap <silent> <c-l> :TmuxNavigateRight<cr>
|
noremap <silent> <c-l> :<C-U>TmuxNavigateRight<cr>
|
||||||
nnoremap <silent> <c-\> :TmuxNavigatePrevious<cr>
|
noremap <silent> <c-\> :<C-U>TmuxNavigatePrevious<cr>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if empty($TMUX)
|
if empty($TMUX)
|
||||||
@ -50,6 +50,12 @@ if !exists("g:tmux_navigator_preserve_zoom")
|
|||||||
let g:tmux_navigator_preserve_zoom = 0
|
let g:tmux_navigator_preserve_zoom = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists("g:tmux_navigator_no_wrap")
|
||||||
|
let g:tmux_navigator_no_wrap = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:pane_position_from_direction = {'h': 'left', 'j': 'bottom', 'k': 'top', 'l': 'right'}
|
||||||
|
|
||||||
function! s:TmuxOrTmateExecutable()
|
function! s:TmuxOrTmateExecutable()
|
||||||
return (match($TMUX, 'tmate') != -1 ? 'tmate' : 'tmux')
|
return (match($TMUX, 'tmate') != -1 ? 'tmate' : 'tmux')
|
||||||
endfunction
|
endfunction
|
||||||
@ -120,6 +126,9 @@ function! s:TmuxAwareNavigate(direction)
|
|||||||
if g:tmux_navigator_preserve_zoom == 1
|
if g:tmux_navigator_preserve_zoom == 1
|
||||||
let l:args .= ' -Z'
|
let l:args .= ' -Z'
|
||||||
endif
|
endif
|
||||||
|
if g:tmux_navigator_no_wrap == 1
|
||||||
|
let args = 'if -F "#{pane_at_' . s:pane_position_from_direction[a:direction] . '}" "" "' . args . '"'
|
||||||
|
endif
|
||||||
silent call s:TmuxCommand(args)
|
silent call s:TmuxCommand(args)
|
||||||
if s:NeedsVitalityRedraw()
|
if s:NeedsVitalityRedraw()
|
||||||
redraw!
|
redraw!
|
||||||
|
@ -7,7 +7,7 @@ windows:
|
|||||||
panes:
|
panes:
|
||||||
- main:
|
- main:
|
||||||
- hgd gmscore
|
- hgd gmscore
|
||||||
- vim -S ~/.sessions/gmscore.vim
|
- vim
|
||||||
- other:
|
- other:
|
||||||
- hgd gmscore
|
- hgd gmscore
|
||||||
- other2:
|
- other2:
|
||||||
@ -18,7 +18,7 @@ windows:
|
|||||||
panes:
|
panes:
|
||||||
- main:
|
- main:
|
||||||
- hgd experimental
|
- hgd experimental
|
||||||
- vim -S ~/.sessions/experimental.vim
|
- vim
|
||||||
- other:
|
- other:
|
||||||
- hgd experimental
|
- hgd experimental
|
||||||
- other2:
|
- other2:
|
||||||
@ -29,7 +29,7 @@ windows:
|
|||||||
- main:
|
- main:
|
||||||
- hgd notes
|
- hgd notes
|
||||||
- cd ../company/users/cnieves/
|
- cd ../company/users/cnieves/
|
||||||
- vim -S ~/.sessions/notes.vim
|
- vim
|
||||||
- other:
|
- other:
|
||||||
- hgd notes
|
- hgd notes
|
||||||
- cd ../company/users/cnieves/
|
- cd ../company/users/cnieves/
|
||||||
@ -41,7 +41,7 @@ windows:
|
|||||||
panes:
|
panes:
|
||||||
- main:
|
- main:
|
||||||
- cd ~/.vim/prefs
|
- cd ~/.vim/prefs
|
||||||
- vim -S ~/.sessions/vim.vim
|
- vim
|
||||||
- other:
|
- other:
|
||||||
- cd ~/.vim/prefs
|
- cd ~/.vim/prefs
|
||||||
- other2:
|
- other2:
|
||||||
|
Reference in New Issue
Block a user