Skip to content

Commit

Permalink
Reapply "Add support for olimorris/tmux-pomodoro-plus tmux plugin. (#22
Browse files Browse the repository at this point in the history
…)"

This reverts commit 012d830.
  • Loading branch information
2KAbhishek committed Nov 3, 2024
1 parent b34b38f commit 74214e6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ set -g @tmux2k-yellow '#f8c800' # change yellow color
- `time`: Show current time and date
- `weather`: Show weather information
- `window`: tmux window list
- `pomodoro`: Shows the `#{pomodoro_status}` of the [tmux-pomodoro-plus](https://github.com/olimorris/tmux-pomodoro-plus) plugin (if installed)

To customize plugins, I'll highly recommend checking out their respective scripts in the [scripts](./scripts) folder.

Expand Down
23 changes: 23 additions & 0 deletions scripts/pomodoro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

if [ -z "$TMUX" ]; then
echo "No tmux session."
exit 1
fi

# Check for olimorris/tmux-pomodoro-plus scripts
POMODORO_SCRIPT="$HOME/.tmux/plugins/tmux-pomodoro-plus/scripts/pomodoro.sh"
POMODORO_HELPER="$HOME/.tmux/plugins/tmux-pomodoro-plus/scripts/helpers.sh"

if [ -f "$POMODORO_SCRIPT" ]; then
. "$POMODORO_SCRIPT"
. "$POMODORO_HELPER"
fi

main() {
pomodoro_status="$(pomodoro_status)"
RATE=$(get_tmux_option "@tmux2k-ping-rate" 5)
sleep "$RATE"
}

main
2 changes: 2 additions & 0 deletions scripts/tmux2k.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ declare -A plugin_colors=(
["weather"]="yellow text"
["time"]="light_blue text"
["window"]="bg_main blue"
["pomodoro"]="bg_main green"
)

get_plugin_colors() {
Expand Down Expand Up @@ -165,6 +166,7 @@ set_theme() {
["weather"]="text yellow"
["time"]="text light_blue"
["window"]="blue bg_main"
["pomodoro"]="text bg_main"
)
fi
}
Expand Down

0 comments on commit 74214e6

Please sign in to comment.