added gpu usage
This commit is contained in:
parent
a68dcc7d88
commit
dcb6f48a4d
4 changed files with 51 additions and 2 deletions
|
@ -29,6 +29,7 @@ main()
|
|||
show_border_contrast=$(get_tmux_option "@dracula-border-contrast" false)
|
||||
show_cpu_usage=$(get_tmux_option "@dracula-cpu-usage" false)
|
||||
show_ram_usage=$(get_tmux_option "@dracula-ram-usage" false)
|
||||
show_gpu_usage=$(get_tmux_option "@dracula-gpu-usage" false)
|
||||
|
||||
# Dracula Color Pallette
|
||||
white='#f8f8f2'
|
||||
|
@ -114,6 +115,11 @@ main()
|
|||
powerbg=${orange}
|
||||
fi
|
||||
|
||||
if $show_gpu_usage; then
|
||||
tmux set-option -ga status-right "#[fg=${pink},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${pink}] #($current_dir/gpu_usage.sh)"
|
||||
powerbg=${pink}
|
||||
fi
|
||||
|
||||
if $show_network; then # network
|
||||
tmux set-option -ga status-right "#[fg=${cyan},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${cyan}] #($current_dir/network.sh)"
|
||||
powerbg=${cyan}
|
||||
|
@ -149,6 +155,10 @@ main()
|
|||
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #($current_dir/cpu_info.sh) "
|
||||
fi
|
||||
|
||||
if $show_gpu_usage; then
|
||||
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${pink}] #($current_dir/gpu_usage.sh) "
|
||||
fi
|
||||
|
||||
if $show_network; then # network
|
||||
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] #($current_dir/network.sh) "
|
||||
fi
|
||||
|
|
37
scripts/gpu_usage.sh
Executable file
37
scripts/gpu_usage.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
get_platform()
|
||||
{
|
||||
case $(uname -s) in
|
||||
Linux)
|
||||
gpu=$(lspci -v | grep -i gpu | grep driver | awk '{print $5}')
|
||||
echo $gpu
|
||||
;;
|
||||
|
||||
Darwin)
|
||||
# TODO - Darwin/Mac compatability
|
||||
;;
|
||||
|
||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||
# TODO - windows compatability
|
||||
;;
|
||||
esac
|
||||
}
|
||||
get_gpu()
|
||||
{
|
||||
gpu=$(get_platform)
|
||||
if [ $gpu == nvidia-gpu ]; then
|
||||
usage=$(nvidia-smi | grep "%" | awk '{print $13}')
|
||||
echo $usage
|
||||
fi
|
||||
}
|
||||
main()
|
||||
{
|
||||
gpu_usage=$(get_gpu)
|
||||
echo "GPU $gpu_usage"
|
||||
sleep 10
|
||||
}
|
||||
# run the main driver
|
||||
main
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue