Merge pull request #163 from pataquets/add-custom-script-plugin

Add 'custom' status plugin to get status texts from external scripts.
This commit is contained in:
Ethan Edwards 2023-04-27 19:26:40 -04:00 committed by GitHub
commit e8598158df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -24,6 +24,7 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul
- CPU usage (percentage or load average) - CPU usage (percentage or load average)
- RAM usage - RAM usage
- GPU usage - GPU usage
- Custom status texts from external scripts
- GPU VRAM usage - GPU VRAM usage
- GPU power draw - GPU power draw
- Color code based on if prefix is active or not - Color code based on if prefix is active or not

View file

@ -123,7 +123,18 @@ main()
for plugin in "${plugins[@]}"; do for plugin in "${plugins[@]}"; do
if [ $plugin = "cwd" ]; then if case $plugin in custom:*) true;; *) false;; esac; then
script=${plugin#"custom:"}
if [[ -x "${current_dir}/${script}" ]]; then
IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-custom-plugin-colors" "cyan dark_gray")
script="#($current_dir/${script})"
else
colors[0]="red"
colors[1]="dark_gray"
script="${script} not found!"
fi
elif [ $plugin = "cwd" ]; then
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cwd-colors" "dark_gray white") IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cwd-colors" "dark_gray white")
tmux set-option -g status-right-length 250 tmux set-option -g status-right-length 250
script="#($current_dir/cwd.sh)" script="#($current_dir/cwd.sh)"