Merge branch 'master' into master
This commit is contained in:
commit
cb27ca216d
6 changed files with 77 additions and 27 deletions
|
@ -21,6 +21,7 @@ Customize the status bar by adding any of these lines to your .tmux.conf as desi
|
||||||
* Switch from default fahrenheit to celsius: `set -g @dracula-show-fahrenheit false`
|
* Switch from default fahrenheit to celsius: `set -g @dracula-show-fahrenheit false`
|
||||||
* Enable powerline symbols: `set -g @dracula-show-powerline true`
|
* Enable powerline symbols: `set -g @dracula-show-powerline true`
|
||||||
* Switch powerline symbols `set -g @dracula-show-left-sep ` for left and `set -g @dracula-show-right-sep ` for right symbol (can set any symbol you like as seperator)
|
* Switch powerline symbols `set -g @dracula-show-left-sep ` for left and `set -g @dracula-show-right-sep ` for right symbol (can set any symbol you like as seperator)
|
||||||
|
* Adjust the refresh rate for the bar `set -g @dracula-refresh-rate 5` the default is 5, it can accept any number
|
||||||
* Enable military time: `set -g @dracula-military-time true`
|
* Enable military time: `set -g @dracula-military-time true`
|
||||||
* Disable timezone: `set -g @dracula-show-timezone false`
|
* Disable timezone: `set -g @dracula-show-timezone false`
|
||||||
* Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character.
|
* Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character.
|
||||||
|
|
|
@ -19,6 +19,7 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul
|
||||||
* Current location based on network with temperature and forecast icon (if available)
|
* Current location based on network with temperature and forecast icon (if available)
|
||||||
* Network connection status and SSID
|
* Network connection status and SSID
|
||||||
* Battery percentage and AC power connection status
|
* Battery percentage and AC power connection status
|
||||||
|
* Refresh rate control
|
||||||
* CPU usage
|
* CPU usage
|
||||||
* RAM usage
|
* RAM usage
|
||||||
* GPU usage
|
* GPU usage
|
||||||
|
|
|
@ -1,10 +1,22 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# function for getting the refresh rate
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
get_percent()
|
get_percent()
|
||||||
{
|
{
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Linux)
|
Linux)
|
||||||
percent=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
percent=$(LC_NUMERIC=en_US.UTF-8 top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
||||||
echo $percent
|
echo $percent
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -21,9 +33,11 @@ get_percent()
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
# storing the refresh rate in the variable RATE, default is 5
|
||||||
|
RATE=$(get_tmux_option "@dracula-refresh-rate" 5)
|
||||||
cpu_percent=$(get_percent)
|
cpu_percent=$(get_percent)
|
||||||
echo "CPU $cpu_percent"
|
echo "CPU $cpu_percent"
|
||||||
sleep 10
|
sleep $RATE
|
||||||
}
|
}
|
||||||
|
|
||||||
# run main driver
|
# run main driver
|
||||||
|
|
|
@ -32,6 +32,8 @@ main()
|
||||||
show_ram_usage=$(get_tmux_option "@dracula-ram-usage" false)
|
show_ram_usage=$(get_tmux_option "@dracula-ram-usage" false)
|
||||||
show_gpu_usage=$(get_tmux_option "@dracula-gpu-usage" false)
|
show_gpu_usage=$(get_tmux_option "@dracula-gpu-usage" false)
|
||||||
show_day_month=$(get_tmux_option "@dracula-day-month" false)
|
show_day_month=$(get_tmux_option "@dracula-day-month" false)
|
||||||
|
show_time=$(get_tmux_option "@dracula-show-time" true)
|
||||||
|
show_refresh=$(get_tmux_option "@dracula-refresh-rate" 5)
|
||||||
|
|
||||||
# Dracula Color Pallette
|
# Dracula Color Pallette
|
||||||
white='#f8f8f2'
|
white='#f8f8f2'
|
||||||
|
@ -79,7 +81,7 @@ main()
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# sets refresh interval to every 5 seconds
|
# sets refresh interval to every 5 seconds
|
||||||
tmux set-option -g status-interval 5
|
tmux set-option -g status-interval $show_refresh
|
||||||
|
|
||||||
# set clock to 12 hour by default
|
# set clock to 12 hour by default
|
||||||
tmux set-option -g clock-mode-style 12
|
tmux set-option -g clock-mode-style 12
|
||||||
|
@ -140,6 +142,7 @@ main()
|
||||||
powerbg=${orange}
|
powerbg=${orange}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if $show_time; then
|
||||||
if $show_day_month && $show_military ; then # military time and dd/mm
|
if $show_day_month && $show_military ; then # military time and dd/mm
|
||||||
tmux set-option -ga status-right "#[fg=${dark_purple},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${white},bg=${dark_purple}] %a %d/%m %R ${timezone} "
|
tmux set-option -ga status-right "#[fg=${dark_purple},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${white},bg=${dark_purple}] %a %d/%m %R ${timezone} "
|
||||||
elif $show_military; then # only military time
|
elif $show_military; then # only military time
|
||||||
|
@ -149,6 +152,7 @@ main()
|
||||||
else
|
else
|
||||||
tmux set-option -ga status-right "#[fg=${dark_purple},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} "
|
tmux set-option -ga status-right "#[fg=${dark_purple},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} "
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${dark_purple}]${left_sep}#[fg=${white},bg=${dark_purple}] #I #W #[fg=${dark_purple},bg=${gray}]${left_sep}"
|
tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${dark_purple}]${left_sep}#[fg=${white},bg=${dark_purple}] #I #W #[fg=${dark_purple},bg=${gray}]${left_sep}"
|
||||||
|
|
||||||
|
@ -181,6 +185,7 @@ main()
|
||||||
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat $current_dir/../data/weather.txt) "
|
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat $current_dir/../data/weather.txt) "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if $show_time; then
|
||||||
if $show_day_month && $show_military ; then # military time and dd/mm
|
if $show_day_month && $show_military ; then # military time and dd/mm
|
||||||
tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %d/%m %R ${timezone} "
|
tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %d/%m %R ${timezone} "
|
||||||
elif $show_military; then # only military time
|
elif $show_military; then # only military time
|
||||||
|
@ -190,6 +195,7 @@ main()
|
||||||
else
|
else
|
||||||
tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} "
|
tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} "
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${dark_purple}] #I #W "
|
tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${dark_purple}] #I #W "
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,22 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# function for getting the refresh rate
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
get_platform()
|
get_platform()
|
||||||
{
|
{
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Linux)
|
Linux)
|
||||||
gpu=$(lspci -v | grep -i gpu | grep driver | awk '{print $5}')
|
gpu=$(lspci -v | grep VGA | head -n 1 | awk '{print $5}')
|
||||||
echo $gpu
|
echo $gpu
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -20,18 +32,20 @@ get_platform()
|
||||||
get_gpu()
|
get_gpu()
|
||||||
{
|
{
|
||||||
gpu=$(get_platform)
|
gpu=$(get_platform)
|
||||||
if [ $gpu == nvidia-gpu ]; then
|
if [[ "$gpu" == NVIDIA ]]; then
|
||||||
usage=$(nvidia-smi | grep "%" | awk '{print $13}')
|
usage=$(nvidia-smi | grep '%' | awk '{ sum += $13 } END { printf("%d%%\n", sum / NR) }')
|
||||||
echo $usage
|
else
|
||||||
|
usage='unknown'
|
||||||
fi
|
fi
|
||||||
|
echo $usage
|
||||||
}
|
}
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
# storing the refresh rate in the variable RATE, default is 5
|
||||||
|
RATE=$(get_tmux_option "@dracula-refresh-rate" 5)
|
||||||
gpu_usage=$(get_gpu)
|
gpu_usage=$(get_gpu)
|
||||||
echo "GPU $gpu_usage"
|
echo "GPU $gpu_usage"
|
||||||
sleep 10
|
sleep $RATE
|
||||||
}
|
}
|
||||||
# run the main driver
|
# run the main driver
|
||||||
main
|
main
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# function for getting the refresh rate
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
get_percent()
|
get_percent()
|
||||||
{
|
{
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
|
@ -37,9 +49,11 @@ get_percent()
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
# storing the refresh rate in the variable RATE, default is 5
|
||||||
|
RATE=$(get_tmux_option "@dracula-refresh-rate" 5)
|
||||||
ram_percent=$(get_percent)
|
ram_percent=$(get_percent)
|
||||||
echo "RAM $ram_percent"
|
echo "RAM $ram_percent"
|
||||||
sleep 10
|
sleep $RATE
|
||||||
}
|
}
|
||||||
|
|
||||||
#run main driver
|
#run main driver
|
||||||
|
|
Loading…
Reference in a new issue